UYOU
如果要在actions中发出请求,可以这样做// main.jsimport VueResource from 'vue-resource' // 当然vue-source需要自己去npm下载Vue.use(VueResource)// actions.js 就是放actions的文件import Vue from 'vue'actions: {isAccessToken({commit}, access_token) {return Vue.http.get('/api/token', () => {//...})}}如果要在actions中查看路由信息,试试这样// actions.jsimport router from '../router' // 路径不一定对,为router路由信息存放的路径actions: {isAccessToken({commit}, access_token) {return Vue.http.get('/api/token', () => {console.log(router.currentRoute)router.push({name: 'login'})})}}