forked from natuka/web.puabadge.com
Initial commit
This commit is contained in:
commit
84061c9a18
243 files changed
+63148
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import type { ConfigProviderTheme } from 'vant'
|
||||
import { localStorage } from '@/utils/local-storage'
|
||||
import { useStore } from '@/stores'
|
||||
|
||||
const store = useStore()
|
||||
const theme = ref<ConfigProviderTheme>('light')
|
||||
const mode = computed(() => store.mode)
|
||||
|
||||
watch(mode, (val) => {
|
||||
if (val === 'dark' || localStorage.get('theme') === 'dark') {
|
||||
theme.value = 'dark'
|
||||
document.querySelector('html')
|
||||
.setAttribute('data-theme', 'dark')
|
||||
}
|
||||
else {
|
||||
theme.value = 'light'
|
||||
document.querySelector('html')
|
||||
.setAttribute('data-theme', 'light')
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
provide('isRealDark', computed(() => theme.value === 'dark'))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<van-config-provider :theme="theme">
|
||||
<router-view />
|
||||
</van-config-provider>
|
||||
</template>
|
||||
Reference in new issue
Block a user