The NavMenu navigation menu in element-UI is opened by default

I recently wrote a website navigation bar. When each page is opened, the first item of the default navigation bar is expanded. I use the NavMenu in the element-UI framework for the navigation bar . I saw the following two parameters, so I wrote them.

<el-menu default-active="1" default-openeds='["1-1"]'>
    ....
<el-menu>

 As a result, it is true that the first item of the navigation bar on each page is opened by default, but the problem arises again. The navigation bar remains open, and there is no response when clicking on other items. It cannot be opened, and the first item cannot be closed. Then I Just searched everywhere and finally found a solution

<el-menu :default-openeds='["0"]'>
    ....
<el-menu>

It's that simple, the value of this default-opends is the index attribute value in el-submenu, you can write whoever you want to open by default

おすすめ

転載: blog.csdn.net/miao_yf/article/details/105285438