wui-components-v2 1.2.19 → 1.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,6 +22,25 @@ export interface LocaleOption {
|
|
|
22
22
|
*/
|
|
23
23
|
export type ThemeMode = 'light' | 'dark'
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* 应用自定义主题变量
|
|
27
|
+
* 在 wot-design-uni 的 ConfigProviderThemeVars 基础上扩展业务自定义字段
|
|
28
|
+
*/
|
|
29
|
+
export interface CustomThemeVars extends ConfigProviderThemeVars {
|
|
30
|
+
darkBackground: string
|
|
31
|
+
darkBackground2: string
|
|
32
|
+
darkBackground3: string
|
|
33
|
+
darkBackground4: string
|
|
34
|
+
darkBackground5: string
|
|
35
|
+
darkBackground6: string
|
|
36
|
+
darkBackground7: string
|
|
37
|
+
darkColor: string
|
|
38
|
+
darkColor2: string
|
|
39
|
+
darkColor3: string
|
|
40
|
+
colorTheme: string
|
|
41
|
+
colorPrimary?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
25
44
|
/**
|
|
26
45
|
* 主题状态接口
|
|
27
46
|
*/
|
|
@@ -31,7 +50,7 @@ export interface ThemeState {
|
|
|
31
50
|
followSystem: boolean
|
|
32
51
|
hasUserSet: boolean
|
|
33
52
|
currentThemeColor: ThemeColorOption
|
|
34
|
-
themeVars:
|
|
53
|
+
themeVars: CustomThemeVars
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
/**
|
|
@@ -39,7 +58,7 @@ export interface ThemeState {
|
|
|
39
58
|
*/
|
|
40
59
|
export interface SystemThemeState {
|
|
41
60
|
theme: ThemeMode
|
|
42
|
-
themeVars:
|
|
61
|
+
themeVars: CustomThemeVars
|
|
43
62
|
}
|
|
44
63
|
|
|
45
64
|
/**
|
package/package.json
CHANGED
|
@@ -112,9 +112,14 @@ export const useManualThemeStore = defineStore('manualTheme', {
|
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* 初始化主题
|
|
115
|
-
*
|
|
115
|
+
* 注:不再读取设备的系统主题色;未手动设置过时强制默认白色
|
|
116
116
|
*/
|
|
117
117
|
initTheme() {
|
|
118
|
+
// 用户未手动设置过主题时,强制默认白色
|
|
119
|
+
// 避免沿用旧版本跟随系统时期写入缓存的深色,也不跟随系统
|
|
120
|
+
if (!this.hasUserSet) {
|
|
121
|
+
this.theme = 'light'
|
|
122
|
+
}
|
|
118
123
|
console.log('初始化主题:', this.theme)
|
|
119
124
|
this.setNavigationBarColor()
|
|
120
125
|
},
|