瀏覽代碼

fix: 修复主题设置逻辑中的路径判断条件

修复了在特定路径下主题颜色设置逻辑错误的问题。通过引入`useRoute`来判断当前路径,确保在非配置页面时正确应用主题颜色。
duy 6 月之前
父節點
當前提交
2dbf9bdf4d
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/App.vue

+ 3 - 2
src/App.vue

@@ -10,11 +10,12 @@ import { useAppStore } from '~src/store'
 import { detectionBrowser, getAppVersion, useOsTheme } from 'hc-vue3-ui'
 import { getObjValue, setElementMainColor } from 'js-fast-way'
 import website from '~src/config'
+import { useRoute } from 'vue-router'
 
 //初始变量
 const appStore = useAppStore()
 const UserTheme = ref(appStore.getTheme)
-
+const useRoutes = useRoute()
 //监听
 watch(() => [appStore.getTheme, appStore.getThemeVal, appStore.getColor], ([Theme, ThemeVal, ColorVal]) => {
     UserTheme.value = Theme
@@ -55,7 +56,7 @@ nextTick(() => {
 const setUserTheme = (theme, appColor) => {
     const projectInfo = appStore.projectInfo
     const id = '1891312830718746625'
-    let isYunNan = projectInfo?.id === id
+    let isYunNan = useRoutes?.path !== '/home/config' && projectInfo?.id === id
     if (isYunNan) {
         setElementMainColor('#409eff')
         let colorName = 'blue'