Files
MrleeAdmin/app/layouts/components/dark-toggle.vue
T

17 lines
377 B
Vue
Raw Normal View History

2026-01-16 22:04:12 +08:00
<template>
<button class="inline-flex justify-center items-center" @click="toggleDark">
<div class="i-ri-sun-line dark:i-ri-moon-line" />
</button>
</template>
<script setup lang="ts">
2026-04-07 11:01:11 +08:00
import { computed } from 'vue'
import { getDark, setDark } from '~/utils/dark'
2026-01-16 22:04:12 +08:00
2026-04-07 11:01:11 +08:00
const isDark = computed(() => getDark())
2026-01-16 22:04:12 +08:00
function toggleDark() {
2026-04-07 11:01:11 +08:00
setDark(!isDark.value)
2026-01-16 22:04:12 +08:00
}
</script>