You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
<template>
|
|
<el-config-provider :locale="locale">
|
|
<router-view></router-view>
|
|
<!-- Stagewise 工具栏 - 仅在开发环境显示 -->
|
|
<StagewiseToolbar v-if="isDev" :config="stagewiseConfig" />
|
|
</el-config-provider>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, onMounted, watch } from 'vue'
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
import en from 'element-plus/dist/locale/en.mjs'
|
|
import useSystemStore from '@/stores/modules/system'
|
|
import useAppStore from '@/stores/modules/app'
|
|
import { useDark, useToggle } from '@vueuse/core'
|
|
import { setThemeColor } from '@/utils/common'
|
|
import { useRoute } from 'vue-router'
|
|
// 导入 Stagewise 相关组件
|
|
import { StagewiseToolbar } from '@stagewise/toolbar-vue'
|
|
import VuePlugin from '@stagewise-plugins/vue'
|
|
|
|
const route = useRoute()
|
|
|
|
// 初始化设置语言
|
|
const systemStore = useSystemStore()
|
|
const locale = computed(() => (systemStore.lang === 'zh-cn' ? zhCn : en))
|
|
|
|
const toggleDark = useToggle(useDark())
|
|
|
|
// Stagewise 配置
|
|
const isDev = import.meta.env.DEV
|
|
const stagewiseConfig = {
|
|
plugins: [VuePlugin]
|
|
}
|
|
|
|
watch(
|
|
route,
|
|
() => {
|
|
useAppStore().$patch((state) => {
|
|
state.route = route
|
|
})
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
|
|
onMounted(() => {
|
|
// 设置主题色
|
|
toggleDark(systemStore.dark)
|
|
setThemeColor(systemStore.theme, systemStore.dark ? 'dark' : 'light')
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss" scoped></style>
|
|
|