hsiangleev / eleTree

Tree component based on virtual dom
https://eletree.hsianglee.cn/
MIT License
43 stars 26 forks source link

isOpen属性渲染后变成int类型 #23

Closed ALuShu closed 3 years ago

ALuShu commented 3 years ago

后台接口返回的数据是children格式的,如下: image boolean类型的数据都是正常的,经过下面的处理渲染: ` /**

// eleTree实例化 var ele = eleTree({ el: '#eletree1', data: treeData, draggable: true, indent: 30, highlightCurrent: true, accordion: true, imgUrl: "../../plugins/eletree/images/", icon: { fold: "connections.png", leaf: "video.png", checkFull: ".eletree_icon-check_full", checkHalf: ".eletree_icon-check_half", checkNone: ".eletree_icon-check_none", dropdownOff: ".eletree_icon-dropdown_right", dropdownOn: ".eletree_icon-dropdown_bottom", loading: ".eleTree-animate-rotate.eletree_icon-loading1", radioCheck: "radioCheck.png", radioCheckNone: "radioCheckNone.png", }, customText: function(data) { var s = data.label if (data.pid === "") { s+=<i class="eletree_icon-edit edit_test"></i> <i class="eletree_icon-delete delete_test"></i> } return s } }) ` 这是渲染后log出来的数据,上面是on事件的data,下面是我上面ajax存起来的一个treeData,事件的data.data正常,不知为啥treeData会在渲染后改变这个值,true为2,false为0 image

hsiangleev commented 3 years ago

@ALuShu

  1. 这个数据是我在内部转的,因为有三种状态,布尔值表示不了了,所以我用012分别代替一种状态
  2. 这个数据可以不用管,如果需要这个数据,可以用getAllNodeData方法获取所有的数据,然后给treeData重新赋值
ALuShu commented 3 years ago

@hsiangleev 好的,已经用别的方案解决