Element-ui左側菜單刷新依舊高亮顯示當前菜單


                

廢話不多說,直接上代碼

 

 <el-menu class="sidebar-el-menu" :default-active="currentMenu" background-color="#324157" @select="handleSelect"
                 text-color="#bfcbd9" active-text-color="#20a0ff" router>
          <el-menu-item v-for="(item,index) in items" :key="index" :index="item.index">
            <i :class="item.icon"></i>
            <span slot="title">{{item.title}}</span>
          </el-menu-item>
        </el-menu>

JS代碼

 
         
data() {
return {
currentUrl:"設置默認的菜單index名稱",
}
},
        
methods: { getUrl(){ let self
= this; let currentUrl = window.location.href; self.currentMenu = currentUrl.split('designer/')[1]; } }, created() { this.getUrl(); }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM