The elementUI sidebar expands all menus by default

First, add: default-openeds="openeds" attribute to the el-menu tag, and define it in data. It defines the value of each index.

<el-menu default-active="3"
 class="el-menu-vertical-demo" 
:default-openeds="openeds" 
@open="handleOpen" 
@close="handleClose">

 

data() {
    return {
      scrollHeight: '0px',
      openeds: ['1', '2', '3'],//默认展开导航栏
    }
}

Guess you like

Origin blog.csdn.net/m0_53591810/article/details/129586953