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> </button>
</template> </template>
<script> <script setup lang="ts">
import { mapActions } from "pinia";
import { useLayoutStore } from "@/stores/layout"; import { useLayoutStore } from "@/stores/layout";
export default { defineProps<{
name: "action", icon: any;
props: ["icon", "label", "counter", "show"], label: any;
methods: { counter: any;
...mapActions(useLayoutStore, ["showHover"]), show: any;
action: function () { }>();
if (this.show) {
this.showHover(this.show);
}
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> </script>
<style></style>