zoukankan      html  css  js  c++  java
  • iview中tree的事件运用

    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  
  • 相关阅读:
    JDBC 精度
    AIX性能监控
    OID View
    Deci and Centi Seconds parsing in java
    SpringMVC @RequestBody问题:Unrecognized field , not marked as ignorable
    Linux SNMP oid
    MySQL 监控
    SVN 搭建
    C# 之 继承
    storm单词计数 本地运行
  • 原文地址:https://www.cnblogs.com/ericLJ/p/9046441.html
Copyright © 2011-2022 走看看