feat:动态路由样式调整

This commit is contained in:
有来技术
2021-11-28 22:49:07 +08:00
parent b048d19d22
commit 1d21c6b098
15 changed files with 146 additions and 150 deletions

View File

@@ -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[]=[]

View File

@@ -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
}

View File

@@ -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)
}
}