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(); }

 

posted @ 2019-07-31 17:19  此夏_唯美  阅读(1902)  评论(0编辑  收藏  举报