在router的beforeach中调用vuex

有两种方法

1、router.app.$store.dispatch('actionName')

2、

直接

import store from './vuex/store/'
import {actionName} from './vuex/actions/'

然后

 actionName(store)
 

就可以了

来源:https://segmentfault.com/q/1010000007476957

原文地址:https://www.cnblogs.com/zhouXX/p/6906404.html