美文网首页让前端飞Web前端之路
解决element-ui el-menu跳转,导航不高亮或没有选

解决element-ui el-menu跳转,导航不高亮或没有选

作者: jia林 | 来源:发表于2019-12-24 17:55 被阅读0次

场景:使用element ui NavMenu导航菜单,跳转到子页面,导航不高亮
解决方案
1、使用default-active绑定计算属性
2、使用 vue-router 的模式,启用该模式会在激活导航时以 index 作为 path 进行路由跳转


image.png

3、计算属性


image.png
computed:{
     activeIndex() {
        const { name } = this.$route;
        switch (name) {
          case 'threemarklist':
          case 'qclist':
            return '/threemarklist';
          case 'purchaseList':
          case 'searchList':
            return '/purchaselist';
          case 'handlePic':
            return "/handlepic";
        }
  }

相关文章

网友评论

    本文标题:解决element-ui el-menu跳转,导航不高亮或没有选

    本文链接:https://www.haomeiwen.com/subject/rribgctx.html