在router的beforeach中调用vuex

Posted wanzhouyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在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

以上是关于在router的beforeach中调用vuex的主要内容,如果未能解决你的问题,请参考以下文章