elementUi tree 实现点击复选框后文字,复选框选中,再次点击取消选中

           
            

 


//writSelection为被选中数组
handleNodeClick(data){
     const index = this.writSelection.findIndex(d => d.id === data.id);
      if(index>-1){
            this.$refs.writTree.setChecked(data,false)
      }else{
            this.$refs.writTree.setChecked(data,true)
            }
     },
handleCheckChange(data, checked, indeterminate){
      if(checked){
         this.writSelection.push(data);
       }else{
             const index = this.writSelection.findIndex(d => d.id === data.id);
              this.writSelection.splice(index, 1);
        }
            console.log("操作后",this.writSelection)
},

 

你可能感兴趣的:(vue,vue)