1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { defineStore } from 'pinia';
- import { AppState } from './types';
- const useAppStore = defineStore('app', {
- state: (): AppState => ({
- version: '1.0.0',
- domain: '',
- device: 'desktop',
- trackConfig: {
- pictureType: ['track'],
- outputDir: '',
- curOutputDir: '',
- outputDirIsDefault: true,
- trackColorType: 'DEFAULT',
- studentFileRule: 'CODE',
- },
- }),
- getters: {
- appInfo(state: AppState): AppState {
- return { ...state };
- },
- },
- actions: {
- resetInfo() {
- this.$reset();
- },
- setInfo(partial: Partial<AppState>) {
- this.$patch(partial);
- },
- toggleDevice(device: string) {
- this.device = device;
- },
- },
- persist: {
- storage: sessionStorage,
- },
- });
- export default useAppStore;
|