const store = new Vuex.Store({
state: {
token: 'xxx'
},
mutations: {
......
上面定义的token,在vue文件里,可以用 this.$store.state.token 获取到,但在纯JS文件里, 怎么获取,通过getApp().$store.state也获取不到。
const store = new Vuex.Store({
state: {
token: 'xxx'
},
mutations: {
......
上面定义的token,在vue文件里,可以用 this.$store.state.token 获取到,但在纯JS文件里, 怎么获取,通过getApp().$store.state也获取不到。
0 个回复