el-menu-item 跳转
时间: 2023-11-22 08:50:52 浏览: 192
EL-IOT-II实验箱使用说明书
el-menu-item跳转是通过在el-menu-item标签中设置index属性来实现的。当点击该el-menu-item时,会触发路由跳转到对应的页面。例如,可以在el-menu标签中添加router属性来启用路由功能,并在每个el-menu-item标签内设置index属性来指定跳转的路径。然后,在路由配置中添加对应的路径映射,使得点击el-menu-item时能够正确跳转到目标页面。具体代码如下所示:
```
<el-menu :router="true">
<el-menu-item index="/home">首页</el-menu-item>
<el-menu-item index="/about">关于</el-menu-item>
<el-menu-item index="/contact">联系我们</el-menu-item>
</el-menu>
```
在这个例子中,当点击首页(el-menu-item)时,会触发路由跳转到"/home"路径对应的页面。同理,点击其他el-menu-item也会跳转到相应的路径。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [el-menu实现路由跳转及当前页的导航](https://blog.csdn.net/weixin_55560445/article/details/114419957)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *3* [vue使用elementui导航栏实现页面间跳转(路由跳转)](https://blog.csdn.net/big_pig_sir/article/details/125797455)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文