style: 全局代码格式化
Former-commit-id: bb50c8419b8fcdeb48c93fce9f399d901e8f5a52
This commit is contained in:
@@ -1,46 +1,48 @@
|
||||
import { AppState } from "@/types";
|
||||
import { localStorage } from "@/utils/storage";
|
||||
import { defineStore } from "pinia";
|
||||
import { getLanguage } from '@/lang/index'
|
||||
import { AppState } from '@/types';
|
||||
import { localStorage } from '@/utils/storage';
|
||||
import { defineStore } from 'pinia';
|
||||
import { getLanguage } from '@/lang/index';
|
||||
|
||||
const useAppStore = defineStore({
|
||||
id: "app",
|
||||
state: (): AppState => ({
|
||||
device: 'desktop',
|
||||
sidebar: {
|
||||
opened: localStorage.get('sidebarStatus') ? !!+localStorage.get('sidebarStatus') : true,
|
||||
withoutAnimation: false
|
||||
},
|
||||
language: getLanguage(),
|
||||
size: localStorage.get('size') || 'default'
|
||||
}),
|
||||
actions: {
|
||||
toggleSidebar() {
|
||||
this.sidebar.opened = !this.sidebar.opened
|
||||
this.sidebar.withoutAnimation = false
|
||||
if (this.sidebar.opened) {
|
||||
localStorage.set('sidebarStatus', 1)
|
||||
} else {
|
||||
localStorage.set('sidebarStatus', 0)
|
||||
}
|
||||
},
|
||||
closeSideBar(withoutAnimation: any) {
|
||||
localStorage.set('sidebarStatus', 0)
|
||||
this.sidebar.opened = false
|
||||
this.sidebar.withoutAnimation = withoutAnimation
|
||||
},
|
||||
toggleDevice(device: string) {
|
||||
this.device = device
|
||||
},
|
||||
setSize(size: string) {
|
||||
this.size = size
|
||||
localStorage.set('size', size)
|
||||
},
|
||||
setLanguage(language: string) {
|
||||
this.language = language
|
||||
localStorage.set('language', language)
|
||||
}
|
||||
}
|
||||
})
|
||||
id: 'app',
|
||||
state: (): AppState => ({
|
||||
device: 'desktop',
|
||||
sidebar: {
|
||||
opened: localStorage.get('sidebarStatus')
|
||||
? !!+localStorage.get('sidebarStatus')
|
||||
: true,
|
||||
withoutAnimation: false
|
||||
},
|
||||
language: getLanguage(),
|
||||
size: localStorage.get('size') || 'default'
|
||||
}),
|
||||
actions: {
|
||||
toggleSidebar() {
|
||||
this.sidebar.opened = !this.sidebar.opened;
|
||||
this.sidebar.withoutAnimation = false;
|
||||
if (this.sidebar.opened) {
|
||||
localStorage.set('sidebarStatus', 1);
|
||||
} else {
|
||||
localStorage.set('sidebarStatus', 0);
|
||||
}
|
||||
},
|
||||
closeSideBar(withoutAnimation: any) {
|
||||
localStorage.set('sidebarStatus', 0);
|
||||
this.sidebar.opened = false;
|
||||
this.sidebar.withoutAnimation = withoutAnimation;
|
||||
},
|
||||
toggleDevice(device: string) {
|
||||
this.device = device;
|
||||
},
|
||||
setSize(size: string) {
|
||||
this.size = size;
|
||||
localStorage.set('size', size);
|
||||
},
|
||||
setLanguage(language: string) {
|
||||
this.language = language;
|
||||
localStorage.set('language', language);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default useAppStore;
|
||||
export default useAppStore;
|
||||
|
||||
Reference in New Issue
Block a user