首页 > 其他 > 详细

iview中tree的事件运用

时间:2018-05-16 16:13:40      阅读:939      评论:0      收藏:0      [点我收藏+]

iview中的事件和方法如下:

技术分享图片

技术分享图片

 

案例说明:

html代码

  <Tree :data="data4" @on-check-change="choiceAll" ref="tree4" show-checkbox multiple></Tree>
-------------------------------------------------------------------------------------------
data(){
  data4: [
  {
    title: ‘parent 1-1‘,
    expand: true,
    children: [
      {
        title: ‘leaf 1-1-1‘,
      },
      {
        title: ‘leaf 1-1-2‘
      }
    ]
  },
  {
    title: ‘parent 1-2‘,
    expand: true,
    children: [
  {
    title: ‘leaf 1-2-1‘,
    checked: true
  },
  {
    title: ‘leaf 1-2-1‘
   }
  ]
  }
]
},
methods:{
  choiceAll:function(data){
    console.log(data);  //当复选框选中时则会打印出选中的内容
    let choicesAll=this.$refs.tree4.getCheckedNodes; //方法的运用 getSelectedNodes也是如此用法
    console.log(choicesAll); 
  }
}
总结:
on-select-change,on-check-change,on-toggle-expand  运用方法是类同而tree方法的运用则需要先添加一个ref  

 

iview中tree的事件运用

原文:https://www.cnblogs.com/ericLJ/p/9046441.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!