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'],//默认展开导航栏
}
}