vue.js - 如何在 Vuex 中获取 Vue Router 参数?

标签 vue.js vue-router vuex

我不会用

this.$route.params
route.params
router.params

如何在我的操作中获取 $route 的参数?

最佳答案

在你的 actions.js 或 store.js 中

import router from 'path/to/router'
console.log(router.currentRoute.params)

关于vue.js - 如何在 Vuex 中获取 Vue Router 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50824234/

相关文章:

html - document.getElementById 在 Vue2 组件中未定义...因为误用了 watch?

javascript - Vue.JS + webpack 构建事件发射问题

Laravel dusk 看不到 vuejs 选择器

typescript - 未找到此依赖项 - TypeScript、Vue

vue.js - 使用 nuxt auth 模块检测身份验证状态需要刷新

javascript - Vue JS如何接受URLEncoded格式

javascript - 旧版浏览器中的 Vue.js 条件渲染

laravel - vue3 无法读取 null 的属性 'insertBefore'

Vue.js 路由器 View 挂载回调

node.js - 具有 Express 和 nginx 反向代理的 Vue Router 历史记录模式