@ruixinkeji/prism-ui 1.0.23 → 1.0.25
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.
- package/package.json +1 -1
- package/store/app.js +17 -6
package/package.json
CHANGED
package/store/app.js
CHANGED
|
@@ -26,7 +26,6 @@ export const useAppStore = defineStore('app', {
|
|
|
26
26
|
// H5 环境 - 给根元素添加 dark-mode 类以更新 CSS 变量
|
|
27
27
|
const htmlElement = document.documentElement;
|
|
28
28
|
const bodyElement = document.body;
|
|
29
|
-
const bgColor = isDark ? '#121212' : '#F5F7FA';
|
|
30
29
|
|
|
31
30
|
if (isDark) {
|
|
32
31
|
htmlElement.classList.add('dark-mode');
|
|
@@ -34,12 +33,16 @@ export const useAppStore = defineStore('app', {
|
|
|
34
33
|
htmlElement.classList.remove('dark-mode');
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
//
|
|
38
|
-
htmlElement.style.backgroundColor = bgColor;
|
|
39
|
-
bodyElement.style.backgroundColor = bgColor;
|
|
40
|
-
|
|
41
|
-
// 更新 meta theme-color 和 color-scheme
|
|
36
|
+
// 从 CSS 变量获取背景色,防止页面切换时闪白
|
|
42
37
|
setTimeout(() => {
|
|
38
|
+
const computedStyle = getComputedStyle(document.documentElement);
|
|
39
|
+
const bgColor = computedStyle.getPropertyValue('--prism-bg-color-page').trim();
|
|
40
|
+
if (bgColor) {
|
|
41
|
+
htmlElement.style.backgroundColor = bgColor;
|
|
42
|
+
bodyElement.style.backgroundColor = bgColor;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 更新 meta theme-color 和 color-scheme
|
|
43
46
|
const themeColor = isDark ? '#0F0F0F' : '#F5F7FA';
|
|
44
47
|
const colorScheme = isDark ? 'dark' : 'light';
|
|
45
48
|
|
|
@@ -94,6 +97,14 @@ export const useAppStore = defineStore('app', {
|
|
|
94
97
|
},
|
|
95
98
|
|
|
96
99
|
initTheme() {
|
|
100
|
+
// 显示 Prism UI 版本信息
|
|
101
|
+
const version = '1.0.25';
|
|
102
|
+
console.log(
|
|
103
|
+
'%c Prism UI %c v' + version + ' ',
|
|
104
|
+
'background: #3B82F6; color: #fff; border-radius: 3px 0 0 3px; padding: 2px 6px;',
|
|
105
|
+
'background: #1E293B; color: #fff; border-radius: 0 3px 3px 0; padding: 2px 6px;'
|
|
106
|
+
);
|
|
107
|
+
|
|
97
108
|
// 获取保存的主题模式
|
|
98
109
|
const savedMode = uni.getStorageSync('prism_theme_mode');
|
|
99
110
|
if (savedMode) {
|