After the vue2 page jumps to other pages, the selected item is still highlighted

Insert image description here
In the component of the menu bar, give the :default-active="getActive" event to determine whether it is jumping to other pages ------>The code is as follows

demo
<el-menu
  :default-active="activeMenu"
  .........
>
</el-menu>
script
activeMenu() {
    
    
      if (this.$route.path === '/index5/ruleCheck' || this.$route.path === '/index5/ruleDetail' || this.$route.path === '/index5/auditissue' || this.$route.path === '/index5/testBench' || this.$route.path === '/index5/ruleAttribute') {
    
    
        return '/index2/ruleDevelopment'
      } else {
    
    
        return this.$route.path
      }
    },

Determine if you jump to the page you want to jump to, return the layer path to be selected, else is the option to be selected in the corresponding navigation bar when jumping to other pages.

Guess you like

Origin blog.csdn.net/GikQxx21_wen/article/details/130385871