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

  1. import { defineStore } from "pinia";
  2. import { type setType, store, getConfig } from "../utils";
  3. export const useSettingStore = defineStore({
  4. id: "pure-setting",
  5. state: (): setType => ({
  6. title: getConfig().Title,
  7. fixedHeader: getConfig().FixedHeader,
  8. hiddenSideBar: getConfig().HiddenSideBar
  9. }),
  10. getters: {
  11. getTitle(state) {
  12. return state.title;
  13. },
  14. getFixedHeader(state) {
  15. return state.fixedHeader;
  16. },
  17. getHiddenSideBar(state) {
  18. return state.hiddenSideBar;
  19. }
  20. },
  21. actions: {
  22. CHANGE_SETTING({ key, value }) {
  23. if (Reflect.has(this, key)) {
  24. this[key] = value;
  25. }
  26. },
  27. changeSetting(data) {
  28. this.CHANGE_SETTING(data);
  29. }
  30. }
  31. });
  32. export function useSettingStoreHook() {
  33. return useSettingStore(store);
  34. }