Vue中如何通过当前路由对象获取其名称?
- 内容介绍
- 文章标签
- 相关推荐
本文共计256个文字,预计阅读时间需要2分钟。
目录 + Vue获取当前路由name + 问题背景 + Vue中name的作用 + Vue获取当前路由name + this.$route.name + 问题背景 + 在当前项目中,1级按钮是通用按钮,需求是在指定的页面点击该按钮时,获取该按钮对应的页面name +
目录
- vue获取当前路由name
- 问题背景
- vue路由中name的作用
vue获取当前路由name
this.$route.name
问题背景
在当前项目中,1处按钮是公用按钮,需求是在指定的页面点击“返回首页”时,获取该指定页面的name值
methods:{ back(){ console.log(this.$route.name) this.$router.push({name:'memberCenterIndex'}); } }
打印一下可以看到当前点击的页面name 值
想要path的话this.$route.path记过打印一下:/couponsActive。
本文共计256个文字,预计阅读时间需要2分钟。
目录 + Vue获取当前路由name + 问题背景 + Vue中name的作用 + Vue获取当前路由name + this.$route.name + 问题背景 + 在当前项目中,1级按钮是通用按钮,需求是在指定的页面点击该按钮时,获取该按钮对应的页面name +
目录
- vue获取当前路由name
- 问题背景
- vue路由中name的作用
vue获取当前路由name
this.$route.name
问题背景
在当前项目中,1处按钮是公用按钮,需求是在指定的页面点击“返回首页”时,获取该指定页面的name值
methods:{ back(){ console.log(this.$route.name) this.$router.push({name:'memberCenterIndex'}); } }
打印一下可以看到当前点击的页面name 值
想要path的话this.$route.path记过打印一下:/couponsActive。

