一,
let obj = this.qs.stringify({ }) this.$axios.post('调取的接口', obj, res => { console.log(res.code); localStorage.setItem('token',this.logindata.token) this.$store.state.token=this.logindata.token; this.$router.push({ path: '/index' }); })
二,
vuex(存储数据)
import Vue from 'vue';import Vuex from 'vuex'; Vue.use(Vuex);const state={ token:''||localStorage.getItem('token')}const mutations={ } export default new Vuex.Store({ state, mutations});