Converted components/settings/Themes.vue to composition api

This commit is contained in:
Joep 2023-09-10 17:15:52 +02:00
parent bb6470edb7
commit 3581e1dd23

View File

@ -1,18 +1,25 @@
<template> <template>
<select v-on:change="change" :value="theme"> <select v-on:change="change" :value="theme">
<option value="">{{ $t("settings.themes.light") }}</option> <option value="">{{ t("settings.themes.light") }}</option>
<option value="dark">{{ $t("settings.themes.dark") }}</option> <option value="dark">{{ t("settings.themes.dark") }}</option>
</select> </select>
</template> </template>
<script> <script setup lang="ts">
export default { import { SelectHTMLAttributes } from "vue";
name: "themes", import { useI18n } from "vue-i18n";
props: ["theme"],
methods: { const { t } = useI18n();
change(event) {
this.$emit("update:theme", event.target.value); defineProps<{
}, theme: any;
}, }>();
const emit = defineEmits<{
(e: "update:theme", val: string | null): void;
}>();
const change = (event: Event) => {
emit("update:theme", (event.target as SelectHTMLAttributes)?.value);
}; };
</script> </script>