sys.js 646 B

123456789101112131415161718192021222324252627282930313233
  1. import { defineStore } from 'pinia';
  2. import app from './app';
  3. const sys = defineStore({
  4. id: 'sys',
  5. state: () => ({
  6. theme: '', // 主题,
  7. mode: 'light', // 明亮模式、暗黑模式(暂未支持)
  8. modeAuto: false, // 跟随系统
  9. fontSize: 1, // 设置默认字号等级(0-4)
  10. }),
  11. getters: {},
  12. actions: {
  13. setTheme(theme = '') {
  14. if (theme === '') {
  15. this.theme = app().template?.basic.theme || 'orange';
  16. } else {
  17. this.theme = theme;
  18. }
  19. },
  20. },
  21. persist: {
  22. enabled: true,
  23. strategies: [
  24. {
  25. key: 'sys-store',
  26. },
  27. ],
  28. },
  29. });
  30. export default sys;