
正文
获取vue路由跳转路径
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
平时BUG:
在vue中使用element ui 中的导航组件时,使用index作为跳转的路径,单击跳转没有问题,但是当刷新页面是,选项卡的激活
状态就变成初始化的了,起起初想到用获取window.location.search方法,效果是可以达到,但是后来发现这操作有的牵强,就换成了vue中
自己的获取路由路径的方式,如下:
let cur_path = this.$route.path; //获取当前路由
let routers = this.$router.options.routes; // 获取路由对象
this.activeIndex=cur_path.replace("/","");
if(cur_path.indexOf("SystemSetup") > 0){
this.activeIndex='SystemSetup'
}






