javascript - 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>
所以我想更改我所在页面的功能键...
解决方案
推荐阅读
- javascript - 如何在不切换到 TypeScript 的情况下将 TypeScript 类型添加到 JavaScript 模块?
- r - 我如何获得R中结果的相应单元格值
- javascript - 禁止缓存使用 base64 字符串构建的图像
- postgresql - 阻止 PostgreSQL 在多行中拆分值?
- scala - 没有案例类的理解不适用
- maven - Maven 多模块,从一个模块开始测试,依赖于另一个模块
- objective-c - NSEvent addLocalMonitorForEventsMatchingMask 内存泄漏
- python - PyQT:在 QListWidgetItem 中获取内容 CustFormWidgetIem
- reactjs - React 路由器将在推送到 anot 后挂载组件
- sql - My SQL - 多表组上的 COUNT 字段按其他字段