mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-11-14 06:33:38 +08:00
feat: add pure-admin-thin
This commit is contained in:
39
src/store/modules/settings.ts
Normal file
39
src/store/modules/settings.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { store } from "/@/store";
|
||||
import { getConfig } from "/@/config";
|
||||
|
||||
interface SettingState {
|
||||
title: string;
|
||||
fixedHeader: boolean;
|
||||
}
|
||||
|
||||
export const useSettingStore = defineStore({
|
||||
id: "pure-setting",
|
||||
state: (): SettingState => ({
|
||||
title: getConfig().Title,
|
||||
fixedHeader: getConfig().FixedHeader
|
||||
}),
|
||||
getters: {
|
||||
getTitle() {
|
||||
return this.title;
|
||||
},
|
||||
getFixedHeader() {
|
||||
return this.fixedHeader;
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user