vue /vuex 在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

猜你喜欢

转载自blog.csdn.net/yelin042/article/details/80275615