import { Mutation/* , Action */ } from 'vuex'; import { StoreModuleType } from "@/utils/store"; import settings from '@/config/settings'; export interface StateType { // 左侧展开收起 collapsed: boolean; // 顶部菜单开启 topNavEnable: boolean; // 头部固定开启 headFixed: boolean; } export interface ModuleType extends StoreModuleType { state: StateType; mutations: { changeLayoutCollapsed: Mutation; setTopNavEnable: Mutation; setHeadFixed: Mutation; }; actions: { }; } const initState: StateType = { collapsed: false, topNavEnable: settings.topNavEnable, headFixed: settings.headFixed, }; const StoreModel: ModuleType = { namespaced: true, name: 'global', state: { ...initState }, mutations: { changeLayoutCollapsed(state, payload) { state.collapsed = payload; }, setTopNavEnable(state, payload) { state.topNavEnable = payload; }, setHeadFixed(state, payload) { state.headFixed = payload; } }, actions: {} } export default StoreModel;