如何在 Vuex 中获取 Vue Router 参数? [英] How to get Vue Router Params in Vuex?
本文介绍了如何在 Vuex 中获取 Vue Router 参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法使用
this.$route.params
route.params
router.params
如何在我的操作中获取 $route 的参数?
how do I get the params of $route in my actions?
推荐答案
在你的 actions.js 或 store.js
in your actions.js or store.js
import router from 'path/to/router'
console.log(router.currentRoute.params)
这篇关于如何在 Vuex 中获取 Vue Router 参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文