除了常用的路由拦截之外,在单独页面对路由监控:
watch:{ $route(to,from){ switch(to.path){ case '/': this.activeName = '1-1' break; case '/syncRecord': this.activeName = '1-2' break; default: this.$router.push('/') this.activeName = '1-1' break; } } },复制代码
本文共 509 字,大约阅读时间需要 1 分钟。
除了常用的路由拦截之外,在单独页面对路由监控:
watch:{ $route(to,from){ switch(to.path){ case '/': this.activeName = '1-1' break; case '/syncRecord': this.activeName = '1-2' break; default: this.$router.push('/') this.activeName = '1-1' break; } } },复制代码
转载于:https://juejin.im/post/5cd2a874e51d453a3a0acb72