vue项目iview树形控件怎么样使用?
Admin 2021-10-18 群英技术资讯 1923 次浏览
vue项目iview树形控件怎么样使用?在vue项目中, iview的树形控件的使用还是比较多的,因此这篇文章就给大家分享一下 iview的树形控件的用法,感兴趣的朋友就继续往下看吧。
1.开发环境 vue+iview
2.电脑系统 windows10专业版
3.在使用 vue+iview开发的过程中,我们经常会使用 iview的树形控件,在这里我就简单的做一个分享,希望对你有所帮助!
4.在template中添加如下代码:
<Scroll style="width: 100%" height="760">
<Tree
@on-select-change="chentreelick"
:data="treedata"
expand-node
></Tree>
</Scroll>
5.在 return 中添加如下代码:
treedata: [
{
title: "parent 1",
chenshow: false,
expand: true,
children: [
{
title: "parent 1-1",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-1-1",
chenshow: true,
},
{
title: "leaf 1-1-2",
chenshow: true,
selected: true,
},
],
},
{
title: "parent 1-2",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-2-1",
chenshow: true,
},
{
title: "leaf 1-2-1",
chenshow: true,
},
],
},
{
title: "parent 1-3",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-3-1",
chenshow: true,
},
{
title: "leaf 1-3-1",
chenshow: true,
},
],
},
{
title: "parent 1-4",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-4-1",
chenshow: true,
},
{
title: "leaf 1-4-1",
chenshow: true,
},
],
},
{
title: "parent 1-5",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-5-1",
chenshow: true,
},
{
title: "leaf 1-5-1",
chenshow: true,
},
],
},
{
title: "parent 1-6",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-6-1",
chenshow: true,
},
{
title: "leaf 1-6-1",
chenshow: true,
},
],
},
{
title: "parent 1-7",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-7-1",
chenshow: true,
},
{
title: "leaf 1-7-1",
chenshow: true,
},
],
},
{
title: "parent 1-8",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-8-1",
chenshow: true,
},
{
title: "leaf 1-8-1",
chenshow: true,
},
],
},
{
title: "parent 1-9",
chenshow: false,
expand: true,
children: [
{
title: "leaf 1-9-1",
chenshow: true,
},
{
title: "leaf 1-9-1",
chenshow: true,
},
],
},
],
},
],
5-1.注意 这个 return中绑定的数据,可以参考 iview官方文档,地址如下:
https://www.iviewui.com/components/tree
6.在 methods中添加如下代码:
chentreelick(data) {
console.log(data);
console.log("点击了");
console.log(data[0].chenshow);
},
//注意:参数 data,在点击的时候可以获取到后台的数据,这个数据是来自后台的,在实际开发中,我们可以 利用 data,把后台需要的id传给 后台
关于iview树形控件的使用就介绍到这,上述示例具有一定的借鉴价值,感兴趣的朋友可以参考,希望能对大家有帮助,想要了解更多iview树形控件的使用,大家可以关注其它的相关文章。
文本转载自脚本之家
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
JavaScript中用set怎样实现数组去重?JavaScript实现数组去重的方法有很多,这里我们主要介绍的用set进行数组去重的方法,文中的示例代码介绍得很详细,有需要的朋友可以参考,接下来就跟随小编一起了解看看吧。
JavaScript中数组的方法种类众多,在ES3-ES7不同版本时期都有新方法;并且数组的方法还有原型方法和从object继承的方法,本文介绍了JavaScript数组及非数组对象的深浅克隆,希望读者能从中有所收获
node的全局对象是“global”,global最根本的作用是作为全局变量的宿主;而所有全局变量(除了global本身以外)都是global对象的属性。在Node.js中可以直接访问到global的属性,而不需要在应用中包含它。
排他思想的算法就是排除掉其他的,本文主要介绍了JavaScript 排他思想的实现,以及介绍了两个示例,感兴趣的可以了解一下
目录关闭对话框后刷新列表父窗口代码子窗口代码关闭打开的窗口后刷新父页面解决办法关闭对话框后刷新列表有些场景需要实现用户弹窗确定后自动刷新列表,父窗口绑定fevent即可父窗口代码template div el-button @click=$refs.editform.dialogFormVisible = tr
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008