mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-09 13:53:38 +08:00
40 lines
888 B
TypeScript
40 lines
888 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() {
|
|
return this.title;
|
|
},
|
|
getFixedHeader() {
|
|
return this.fixedHeader;
|
|
},
|
|
getHiddenSideBar() {
|
|
return this.HiddenSideBar;
|
|
}
|
|
},
|
|
actions: {
|
|
CHANGE_SETTING({ key, value }) {
|
|
// eslint-disable-next-line no-prototype-builtins
|
|
if (this.hasOwnProperty(key)) {
|
|
this[key] = value;
|
|
}
|
|
},
|
|
changeSetting(data) {
|
|
this.CHANGE_SETTING(data);
|
|
}
|
|
}
|
|
});
|
|
|
|
export function useSettingStoreHook() {
|
|
return useSettingStore(store);
|
|
}
|