Login token
Call login interface, store the token after successful callback,(vuex, localStorage)
State: {/ / define a token token: localStorage. The getItem (' token ')? localStorage.getItem('token') : '', }, mutations: ChangeLogin (state, user) {state.token = user.token; localStorage.setItem('token', user.token); ClearLogin (state){state.token = ""; Localstorage.removeitem ('token')}}, getters:{login: state => {return state.token! = = '}},Copy the code