Updated Action.vue to composition api & typescript.

This commit is contained in:
Joep 2023-10-07 13:44:46 +02:00
parent 23fd2e1466
commit bb8c67fa8c
No known key found for this signature in database
GPG Key ID: 6F5588F1DC2A8209

View File

@ -6,24 +6,28 @@
</button>
</template>
<script>
import { mapActions } from "pinia";
<script setup lang="ts">
import { useLayoutStore } from "@/stores/layout";
export default {
name: "action",
props: ["icon", "label", "counter", "show"],
methods: {
...mapActions(useLayoutStore, ["showHover"]),
action: function () {
if (this.show) {
this.showHover(this.show);
}
defineProps<{
icon: any;
label: any;
counter: any;
show: any;
}>();
this.$emit("action");
},
},
const emit = defineEmits<{
(e: "action"): void;
}>();
const layoutStore = useLayoutStore();
const action = () => {
if (layoutStore.show) {
// TODO: is not very pretty
layoutStore.showHover(layoutStore.show as string);
}
emit("action");
};
</script>
<style></style>