element-ui中导航菜单默认激活子菜单的第一项
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
·
默认激活子菜单的第一项
代码部分:
<!-- 设置默认选中的选项为1-0 -->
<el-menu
class="el-menu-vertical-demo"
background-color="#eef1f7"
text-color="#6c6f72"
active-text-color="#ffd04b"
unique-opened
default-active="1-0"
>
<el-submenu index="1"
>
<template slot="title">
<i class="el-icon-location"></i>
<span>2018级班级名单</span>
</template>
<!--
:index="'1-'+index"用于给每个item独有的index值
:default-active="'1-' + index"我们查看对应的default-active
-->
<el-menu-item
:default-active="'1-' + index"
:index="'1-'+ index"
v-for="(item,index) in ListClass2018"
:key="index"
@click="getStuList2018(item)">{{item}}</el-menu-item>
</el-submenu>
</el-menu>
在开发者模式我们可以看到default-active的值,并将1-0这一项的状态选中为激活状态(在el-menu中设置)
效果展示
默认选中第一项
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45
1 年前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 1 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)