@neatui/vue 1.2.10 → 1.2.12
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/src/store/myui.ts +25 -11
package/package.json
CHANGED
package/src/store/myui.ts
CHANGED
|
@@ -4,13 +4,11 @@ import { defineStore } from 'pinia';
|
|
|
4
4
|
export const useMyuiStore = defineStore('myui', {
|
|
5
5
|
state: () => {
|
|
6
6
|
return {
|
|
7
|
-
full: 0,
|
|
7
|
+
full: localStorage.getItem('neatui_full') || 0,
|
|
8
8
|
// 字号
|
|
9
|
-
|
|
9
|
+
size: localStorage.getItem('neatui_size') || document?.documentElement?.getAttribute('size') || 'm',
|
|
10
10
|
// 主题
|
|
11
|
-
theme: localStorage.getItem('theme') || 'auto',
|
|
12
|
-
// 所有主题
|
|
13
|
-
themes: [],
|
|
11
|
+
theme: localStorage.getItem('neatui_theme') || document?.documentElement?.getAttribute('theme') || 'auto',
|
|
14
12
|
// 侧边
|
|
15
13
|
side: 1
|
|
16
14
|
};
|
|
@@ -18,19 +16,35 @@ export const useMyuiStore = defineStore('myui', {
|
|
|
18
16
|
getters: {},
|
|
19
17
|
actions: {
|
|
20
18
|
// 设置全屏显示
|
|
21
|
-
async
|
|
19
|
+
async setfull(then = (res: any) => {}) {
|
|
22
20
|
const full = this.full ? 0 : 1;
|
|
23
|
-
localStorage.setItem('neatui_full', `${full}`);
|
|
24
21
|
this.full = full;
|
|
22
|
+
localStorage.setItem('neatui_full', `${full}`);
|
|
25
23
|
then(full);
|
|
26
24
|
},
|
|
27
25
|
// 设置系统主题
|
|
28
|
-
async
|
|
29
|
-
|
|
26
|
+
async settheme(theme: any = '', then = (res: any) => {}) {
|
|
27
|
+
if (theme) {
|
|
28
|
+
localStorage.setItem('neatui_theme', theme);
|
|
29
|
+
this.theme = theme;
|
|
30
|
+
document.documentElement.setAttribute('theme', theme);
|
|
31
|
+
then(theme);
|
|
32
|
+
} else {
|
|
33
|
+
document.documentElement.setAttribute('theme', this.theme);
|
|
34
|
+
then(this.theme);
|
|
35
|
+
}
|
|
30
36
|
},
|
|
31
37
|
// 设置系统字号
|
|
32
|
-
async
|
|
33
|
-
|
|
38
|
+
async setsize(size: any = '', then = (res: any) => {}) {
|
|
39
|
+
if (size) {
|
|
40
|
+
localStorage.setItem('neatui_size', size);
|
|
41
|
+
this.size = size;
|
|
42
|
+
document.documentElement.setAttribute('size', size);
|
|
43
|
+
then(size);
|
|
44
|
+
} else {
|
|
45
|
+
document.documentElement.setAttribute('size', this.size);
|
|
46
|
+
then(this.size);
|
|
47
|
+
}
|
|
34
48
|
}
|
|
35
49
|
}
|
|
36
50
|
});
|