mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix:抽离首页主题设置成hooks
This commit is contained in:
+5
-36
@@ -12,50 +12,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue'
|
||||
import {
|
||||
zhCN,
|
||||
dateZhCN,
|
||||
darkTheme,
|
||||
NConfigProvider,
|
||||
GlobalThemeOverrides
|
||||
} from 'naive-ui'
|
||||
import { zhCN, dateZhCN, NConfigProvider } from 'naive-ui'
|
||||
import { AppProvider } from '@/components/Application'
|
||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||
import { borderRadius } from '@/settings/designSetting'
|
||||
|
||||
import { getDarkThemeHook, getThemeOverridesHook } from '@/hooks'
|
||||
|
||||
const designStore = useDesignStore()
|
||||
|
||||
// 返回暗黑主题
|
||||
const getDarkTheme = computed(() =>
|
||||
designStore.getDarkTheme ? darkTheme : undefined
|
||||
)
|
||||
const getDarkTheme = getDarkThemeHook()
|
||||
|
||||
// 主题配置
|
||||
const getThemeOverrides = computed(
|
||||
(): GlobalThemeOverrides => {
|
||||
const commonObj = {
|
||||
common: {
|
||||
borderRadius
|
||||
}
|
||||
}
|
||||
const lightObject = {
|
||||
common: {
|
||||
...commonObj.common
|
||||
}
|
||||
}
|
||||
const dartObject = {
|
||||
common: {
|
||||
primaryColor: designStore.appTheme,
|
||||
...commonObj.common
|
||||
},
|
||||
LoadingBar: {
|
||||
colorLoading: designStore.appTheme
|
||||
}
|
||||
}
|
||||
return designStore.getDarkTheme ? dartObject : lightObject
|
||||
}
|
||||
)
|
||||
const getThemeOverrides = getThemeOverridesHook()
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
|
||||
Reference in New Issue
Block a user