首页 > 解决方案 > VueJS:我在页面上的活动菜单

问题描述

我生成了一个菜单,该菜单会根据我在应用程序中某些位置收到的数据进行更改。

我不能让默认选择的键是动态的。

简而言之:根据我所在的页面,我希望突出显示特定项目。

例如,当 customerChoosen 为 true 时,我会显示一个菜单项,但我希望突出显示该项。我不知道如何将“默认选定键”动态传递给另一个号码。还是有另一种方法来实现它?

感谢帮助

      <a-menu theme="dark" :default-selected-keys="['1']" mode="inline" >

        <a-menu-item key="1"  >
          <a-icon type="home" />
          <span><nuxt-link to="/dashboardHome">Clients</nuxt-link></span>
        </a-menu-item>


        <a-menu-item key="2" v-if="customerChoosen">
          <a-icon type="user" />
          <span><nuxt-link  v-bind:to="`/customers/${nameCustomer.id}`">{{nameCustomer.name}}</nuxt-link></span>
        </a-menu-item>


        <a-sub-menu v-for="(projet,index) in nameCustomer.projects" v-bind:key="`sub${index}`"  v-if="customerChoosen" >

          <span slot="title"><a-icon type="project" /><span>{{projet.title}}</span></span>

              <a-menu-item v-for="(study,i) in projet.studies" v-bind:key="study.id">
                {{study.name}}
              </a-menu-item>


        </a-sub-menu>


      </a-menu>

所以我想更改我所在页面的功能键...

标签: javascriptvue.jsantdv

解决方案


推荐阅读