iview实现select tree树形下拉框的示例代码
更新时间:2018年12月21日 15:57:22 作者:东方的神秘力量
这篇文章主要介绍了iview实现select tree树形下拉框的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
本文介绍了iview实现select tree树形下拉框的示例代码,分享给大家,具体如下:
html部分
<Tree :data="treeData" ref="tree" :render="renderContent"></Tree>
数据部分
export const treeData= [
{
title: 'parent 1',
expand: true,
selected: true,
value: '1',
children: [
{
title: 'parent 1-1',
expand: true,
value: '11',
children: [
{
value: '111',
title: 'leaf 1-1-1'
},
{
value: '112',
title: 'leaf 1-1-2'
}
]
},
{
title: 'parent 1-2',
value: '12',
expand: true,
children: [
{
value: '121',
title: 'leaf 1-2-1'
},
{
value: '122',
title: 'leaf 1-2-2'
}
]
}
]
}
];
js部分
// 子节点的option
renderContent (h, { root, node, data }) {
return h('Option', {
style: {
display: 'inline-block',
margin: '0'
},
props:{
value: data.value
}
}, data.title);
},
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
相关文章
Element-UI 解决el-table中图片悬浮被遮挡问题小结
在开发中,发现element-ui在el-table中添加图片悬浮显示时,会被单元格遮挡的问题,对于此问题解决其实也并不难,将悬浮图片放在body节点下,通过定位显示即可,感兴趣的朋友跟随小编一起看看吧2024-06-06


最新评论