element-ui导航菜单el-menu树型横向展示

431 阅读1分钟

1首先定义Menu组件

image.png

主要也是运用递归思想,当数据元素存在子树(children),那就调用Menu组件自身,传递子树数据(item.children)。

2组件调用

image.png

其中element中el-menu组件中的属性 mode="horizontal" 可以为横向排列
最后的样式大家可以用css的扩展语言less ::v-deep深度选择器来更待element的样式