1. 程式人生 > >獲取vue路由跳轉路徑

獲取vue路由跳轉路徑

this index outer location systems 平時 ons arch 使用

平時BUG:

  在vue中使用element ui 中的導航組件時,使用index作為跳轉的路徑,單擊跳轉沒有問題,但是當刷新頁面是,選項卡的激活
狀態就變成初始化的了,起起初想到用獲取window.location.search方法,效果是可以達到,但是後來發現這操作有的牽強,就換成了vue中
自己的獲取路由路徑的方式,如下:

1 let cur_path = this.$route.path;                 //獲取當前路由
2 let routers = this.$router.options.routes;   // 獲取路由對象
3 this.activeIndex=cur_path.replace("/","");
4 if(cur_path.indexOf("SystemSetup") > 0){ 5 this.activeIndex=‘SystemSetup‘ 6 }

獲取vue路由跳轉路徑