獲取vue路由跳轉路徑

平時BUG:vue

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

 

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 }
相關文章
相關標籤/搜索