fe-interview icon indicating copy to clipboard operation
fe-interview copied to clipboard

[vue] 在vue组件中怎么获取到当前的路由信息?

Open haizhilin2013 opened this issue 7 years ago • 5 comments

[vue] 在vue组件中怎么获取到当前的路由信息?

haizhilin2013 avatar Jun 20 '19 20:06 haizhilin2013

this.$router.path 或者 this.$router

miqidian avatar Aug 06 '19 03:08 miqidian

this.$router.path 或者 this.$router

是this.$route.path吧

Real102 avatar Sep 27 '19 03:09 Real102

this.$router.path 或者 this.$router

是this.$route.path吧

对,

liuxiaoyang1 avatar Nov 19 '19 14:11 liuxiaoyang1

如果是template中获取直接 $route 即可 如果是script中获取 this.$route 可以 console.log(this.$route) 查看其详细信息

zlqGitHub avatar Dec 23 '19 10:12 zlqGitHub

this.$route

WenJieLi1998 avatar Apr 19 '20 01:04 WenJieLi1998