Files
love-nav-vue/src/store/index.js
2023-12-23 21:33:16 +08:00

31 lines
591 B
JavaScript

import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
theme:'dark',
// 存储token
Authorization: localStorage.getItem('Authorization') ? localStorage.getItem('Authorization') : '',
},
getters: {
},
mutations: {
SET_THEME:(state,data)=>{
state.theme=data;
window.sessionStorage.setItem('theme',data);
},
changeLogin (state, user) {
state.Authorization = user.Authorization;
localStorage.setItem('Authorization', user.Authorization);
}
},
actions: {
},
modules: {
}
})