wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { reactive, ref } from "vue";
import { storage } from "../utils";
import { config } from "/@/config";
import { defineStore } from "pinia";
 
// 主题
export const useTheme = defineStore("theme", () => {
    const name = ref(storage.get("theme") || "default");
 
    function set(value: string) {
        name.value = value;
        storage.set("theme", value);
    }
 
    return {
        name,
        set,
    };
});
 
export function useApp() {
    const info = reactive(config.app);
 
    return {
        info,
        theme: useTheme(),
    };
}