feat:动态路由样式调整
This commit is contained in:
@@ -3,7 +3,7 @@ import {createStore,useStore as baseUseStore ,Store} from 'vuex'
|
||||
import {RootStateTypes} from "@store/interface";
|
||||
|
||||
// Vite 使用特殊的 import.meta.glob 函数从文件系统导入多个模块
|
||||
// see https://cn.vitejs.dev/guide/features.html#glob-import
|
||||
// @see https://cn.vitejs.dev/guide/features.html#glob-import
|
||||
const moduleFiles = import.meta.globEager('./modules/*.ts')
|
||||
const paths:string[]=[]
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ export interface UserState {
|
||||
perms: string[]
|
||||
}
|
||||
|
||||
|
||||
export interface AppState {
|
||||
device: string,
|
||||
sidebar: {
|
||||
@@ -26,7 +25,6 @@ export interface SettingState {
|
||||
sidebarLogo: boolean
|
||||
}
|
||||
|
||||
|
||||
export interface PermissionState{
|
||||
routes:RouteRecordRaw[]
|
||||
addRoutes: RouteRecordRaw[]
|
||||
@@ -41,12 +39,11 @@ export interface TagsViewState{
|
||||
cachedViews: (string|undefined)[]
|
||||
}
|
||||
|
||||
|
||||
// 顶级类型声明
|
||||
export interface RootStateTypes {
|
||||
user: UserState,
|
||||
app: AppState,
|
||||
setting: SettingState,
|
||||
settings: SettingState,
|
||||
permission:PermissionState,
|
||||
tagsView:TagsViewState
|
||||
}
|
||||
@@ -14,6 +14,7 @@ const appModule: Module<AppState, RootStateTypes> = {
|
||||
mutations: {
|
||||
TOGGLE_SIDEBAR: state => {
|
||||
state.sidebar.opened = !state.sidebar.opened
|
||||
console.log('state.sidebar.opened',state.sidebar.opened)
|
||||
state.sidebar.withoutAnimation = false
|
||||
if (state.sidebar.opened) {
|
||||
Local.set('sidebarStatus', 1)
|
||||
@@ -27,6 +28,7 @@ const appModule: Module<AppState, RootStateTypes> = {
|
||||
state.sidebar.withoutAnimation = withoutAnimation
|
||||
},
|
||||
TOGGLE_DEVICE: (state, device) => {
|
||||
console.log('TOGGLE_DEVICE',device)
|
||||
state.device = device
|
||||
}
|
||||
},
|
||||
@@ -37,7 +39,7 @@ const appModule: Module<AppState, RootStateTypes> = {
|
||||
closeSideBar({commit}, {withoutAnimation}) {
|
||||
commit('CLOSE_SIDEBAR', withoutAnimation)
|
||||
},
|
||||
toggleDevice({commit}, device) {
|
||||
async toggleDevice({commit}, device) {
|
||||
commit('TOGGLE_DEVICE', device)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user