@ruixinkeji/prism-ui 1.0.23 → 1.0.24

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/store/app.js +9 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruixinkeji/prism-ui",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Prism UI - 现代化玻璃态设计 uni-app 组件库",
5
5
  "main": "index.js",
6
6
  "module": "index.esm.js",
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
- // 设置 html 和 body 背景色,防止页面切换时闪白
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