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