mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-25 07:57:18 +08:00
39 lines
848 B
TypeScript
39 lines
848 B
TypeScript
import { defineStore } from "pinia";
|
|
import { store } from "@/store";
|
|
import { setType } from "./types";
|
|
import { getConfig } from "@/config";
|
|
|
|
export const useSettingStore = defineStore({
|
|
id: "pure-setting",
|
|
state: (): setType => ({
|
|
title: getConfig().Title,
|
|
fixedHeader: getConfig().FixedHeader,
|
|
hiddenSideBar: getConfig().HiddenSideBar
|
|
}),
|
|
getters: {
|
|
getTitle(state) {
|
|
return state.title;
|
|
},
|
|
getFixedHeader(state) {
|
|
return state.fixedHeader;
|
|
},
|
|
getHiddenSideBar(state) {
|
|
return state.hiddenSideBar;
|
|
}
|
|
},
|
|
actions: {
|
|
CHANGE_SETTING({ key, value }) {
|
|
if (Reflect.has(this, key)) {
|
|
this[key] = value;
|
|
}
|
|
},
|
|
changeSetting(data) {
|
|
this.CHANGE_SETTING(data);
|
|
}
|
|
}
|
|
});
|
|
|
|
export function useSettingStoreHook() {
|
|
return useSettingStore(store);
|
|
}
|