如何获取router-link的当前路由?-灵析社区

皮皮踢

在根组件APP.vue中的导航标签中设置了三个router-link,每当我切换路由时,如何才能获取到当前点击的路由地址? Stator | Rotor | Search changeBGC () { const arr = this.$router.options.routes // console.log('我是路径数组', arr) const path = arr.map(item => { // console.log('我是数组对象', item.path) // 循环出数组对象 return item.path }) if ( === '/searchview') return this.isbgc === true }

阅读量:248

点赞量:10

问AI
木子弓长
this.$route.path