fix: dark mode
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
const preference = computed(() => {
|
||||
// 默认为自动,会跟随用户的浏览器切换
|
||||
if (colorMode.preference === 'system') {
|
||||
if (preferredColor.value === 'no-preference') return 'dark'
|
||||
return preferredColor.value
|
||||
}
|
||||
return colorMode.preference
|
||||
@ -18,14 +19,6 @@
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<UButton
|
||||
:icon="
|
||||
preference === 'dark'
|
||||
? 'i-heroicons-sun-20-solid'
|
||||
: 'i-heroicons-moon-20-solid'
|
||||
"
|
||||
color="primary"
|
||||
@click="toggleColorMode"
|
||||
/>
|
||||
<UButton :icon="preference === 'dark' ? 'i-lucide-sun' : 'i-lucide-moon'" color="primary" @click="toggleColorMode" />
|
||||
</div>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user