前端新增可配置侧边栏风格,可以配置网页主题色
This commit is contained in:
@@ -5,6 +5,7 @@ import VuexPersistence from 'vuex-persist'
|
||||
import { user } from '@/store/module/user'
|
||||
import { router } from '@/store/module/router'
|
||||
import { dictionary } from '@/store/module/dictionary'
|
||||
import { app } from '@/store/module/app'
|
||||
Vue.use(Vuex)
|
||||
|
||||
const vuexLocal = new VuexPersistence({
|
||||
@@ -15,7 +16,8 @@ export const store = new Vuex.Store({
|
||||
modules: {
|
||||
user,
|
||||
router,
|
||||
dictionary
|
||||
dictionary,
|
||||
app
|
||||
},
|
||||
plugins: [vuexLocal.plugin]
|
||||
})
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import variables from '@/style/element_visiable.scss'
|
||||
export const app = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
theme: variables.colorPrimary,
|
||||
sideMode: 'dark'
|
||||
},
|
||||
mutations: {
|
||||
CHANGETHEME: (state, value) => {
|
||||
state.theme = value
|
||||
},
|
||||
CHANGESIDEMODE: (state) => {
|
||||
if (state.sideMode === 'dark') {
|
||||
state.sideMode = 'light'
|
||||
} else {
|
||||
state.sideMode = 'dark'
|
||||
}
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
changeTheme({ commit }, data) {
|
||||
commit('CHANGETHEME', data)
|
||||
},
|
||||
changeSideMode({ commit }) {
|
||||
commit('CHANGESIDEMODE')
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
getSIdeMode(state) {
|
||||
return state.sideMode
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user