Commit a97db2754a397db4d8ac78c902f39d1859929823
1 parent
9801195a
fix: 暗黑模式bug
Showing
1 changed file
with
3 additions
and
8 deletions
yudao-ui-admin-vue3/src/App.vue
| ... | ... | @@ -15,15 +15,10 @@ const { wsCache } = useCache() |
| 15 | 15 | |
| 16 | 16 | // 根据浏览器当前主题设置系统主题色 |
| 17 | 17 | const setDefaultTheme = () => { |
| 18 | - if (wsCache.get(CACHE_KEY.IS_DARK)) { | |
| 19 | - if (wsCache.get(CACHE_KEY.IS_DARK) || wsCache.get(CACHE_KEY.IS_DARK) === 'true') { | |
| 20 | - appStore.setIsDark(true) | |
| 21 | - } else { | |
| 22 | - appStore.setIsDark(false) | |
| 23 | - } | |
| 24 | - return | |
| 18 | + let isDarkTheme = wsCache.get(CACHE_KEY.IS_DARK) | |
| 19 | + if (isDarkTheme === null) { | |
| 20 | + isDarkTheme = isDark() | |
| 25 | 21 | } |
| 26 | - const isDarkTheme = isDark() | |
| 27 | 22 | appStore.setIsDark(isDarkTheme) |
| 28 | 23 | } |
| 29 | 24 | setDefaultTheme() | ... | ... |