success news hot
This commit is contained in:
@@ -6,14 +6,29 @@ Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
theme:'dark',
|
||||
// 存储token
|
||||
Authorization: localStorage.getItem('Authorization') ? localStorage.getItem('Authorization') : '',
|
||||
isLogin:'0',
|
||||
},
|
||||
getters: {
|
||||
getStorage(state){ // 获取本地存储的登录信息
|
||||
if(!state.Authorization){
|
||||
state.Authorization =JSON.parse(localStorage.getItem(key))
|
||||
}
|
||||
return state.Authorization
|
||||
}
|
||||
},
|
||||
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: {
|
||||
},
|
||||
|
Reference in New Issue
Block a user