Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize infinite multi-level classification of menu bar by vue+el-menu

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces vue+el-menu how to achieve unlimited multi-level classification of the menu bar, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The details are as follows

Idea: the data format must be a multi-layer nesting mode within the array, and the recursive rendering menu bar data is used to realize menu multi-level classification.

1. Simulate menu data and introduce encapsulation components

Header Main import MenuTree from'.. / components/MentTree'export default {components: {MenuTree}, data () {return {menuList: [{index: '1percent, icon:' el-icon-menu' Name: 'first level menu 01menu, children: [{index:' 1-1menu, icon: 'el-icon-film', name:' second-level menu 01menu, children: [{index:'1-1-1'' Icon: 'el-icon-date', name:' three-level menu 01menu, children: [{index:'1-1-1-1-1, icon: 'el-icon-monitor' Name: 'level 4 menu 01'}]}, {index:' 1-1-2, icon: 'el-icon-headset' Name: 'level 3 menu 02'}}, {index:' 1-2 menu, icon: 'el-icon-data-line', name: level 2 menu 02'}]} {index: '2menu, icon:' el-icon-s-data', name: 'level I menu 02'}, {index:' 3menu, icon: 'el-icon-s-operation', name:' level I menu 03'}, {index:'4' Icon: 'el-icon-user', name:' first-level menu 04'}]}, mounted () {}, methods: {}}

Recursive rendering of menu bar within 2.MenuTree component

{{menu.name}} {{menu.name}} export default {props: ['menuData'], name:' MenuTree'}

3. Complete the effect display

Thank you for reading this article carefully. I hope the article "how to achieve unlimited levels of classification in the menu bar by vue+el-menu" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report