You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
496 B
29 lines
496 B
|
6 days ago
|
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(),
|
||
|
|
};
|
||
|
|
}
|