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.
36 lines
801 B
36 lines
801 B
import { defineStore } from "pinia";
|
|
import { type setType, store, getConfig } from "../utils";
|
|
|
|
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);
|
|
}
|