你好,我是用的最新版本的Element-UI的框架,我想通过后端请求过来的数据到前端渲染成菜单形式,但是没有找到相应的数据接口,也就无法构建出菜单了。
最新版本
Win7/Chrome 53
2.0.0-rc.4
希望通过数据接口自定义菜单。
没有找到相应的接口,尽管在源码中能找到data部分,但是太过简略,没有找到相应的文档说明。
先吐槽一下最新版本的element-ui对应的Vue版本也应该是最新的🌝
这个问题和element本身关系不大,建议仔细看看Vue的文档,合理利用v-for渲染。
超简单的例子:
<el-menu default-active="1">
<el-menu-item :index="item.index" v-for="item in menu">{{item.title}}</el-menu-item>
</el-menu>
<script>
export default {
data () {
return {
menu: [
{ title: '菜单1', index: 1 },
{ title: '菜单2', index: 2 }
]
}
}
}
</script>
Most helpful comment
先吐槽一下最新版本的element-ui对应的Vue版本也应该是最新的🌝
这个问题和element本身关系不大,建议仔细看看Vue的文档,合理利用v-for渲染。
超简单的例子: