問題を強調要素-UI NavMenuのナビゲーションメニュー

文書の多くを確認した
ソリューションを:
、ルーティングモードを開き、デフォルトのアクティブラベルの設定
バインディングを:default-active="$route.path"
私が遭遇した問題は解決しないことが判明し
た文書を参照してください、そうします。https://blog.csdn.net/Jayne_z/article/details / 88028336
統合GETプランB

対処方法2:

<el-menu
		:default-active="activeIndex" 
		class="el-menu-demo"
		mode="horizontal"
		router        
		@select="handleSelect"  
		text-color="#333"      
		active-text-color="#00bf94"> 
	<el-menu-item index="/index">首页</el-menu-item> 
	<el-menu-item index="/order">订单</el-menu-item> 
	<el-menu-item index="/product">我的产品</el-menu-item> 
</el-menu>

data() {
      return {
          navConfig:{
              'index':'/index',
              'order':'/order',
              'product':'/product'
          },
          activeIndex: '/index'
      };
},
mounted(){
    var href = window.location.href
    href = href.split('#/')[1]
    if(href.search('/')){
        href = href.split('/')[0]
        this.activeIndex = this.navConfig[href]
     }else {
        this.activeIndex = this.navConfig[href]
},
リリース元の2件の記事 ウォンの賞賛2 ビュー64

おすすめ

転載: blog.csdn.net/Kancy_K/article/details/104516777