/* * @Author: wei.li * @Date: 2021-12-23 17:33:20 * @LastEditors: wei.li * @LastEditTime: 2024-07-02 08:54:14 * @Description: file content */ import { defineStore } from 'pinia'; import { store } from '../index'; import type { setType } from './types'; import { getConfig } from '../../config'; export const useSettingStore = defineStore('udp-setting', { state: (): setType => ({ fixedHeader: getConfig().FixedHeader, hiddenSideBar: getConfig().HiddenSideBar }), getters: { getFixedHeader() { return this.fixedHeader; }, getHiddenSideBar() { return this.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); }