wchbrad / vue-easy-tree

A tree component based on vue2.x that supports a small amount of data or a large amount of data, multiple functions, and virtual scrolling.
MIT License
124 stars 39 forks source link

根据data中的属性,隐藏checkbox #25

Closed hu2014 closed 1 year ago

hu2014 commented 1 year ago

大佬,我想实现根据数据中的某个属性,决定是否展示checkbox,怎么弄啊。比如图片中,不想要通道的checkbo展示出来。这个树的层级不定,可能会嵌套很深。 image

wchbrad commented 1 year ago

使用render-content自定义内容,check-box根据data属性的需要渲染

hu2014 commented 1 year ago

那这样生成的checkbox就不能使用定义好的那些方法了吧。比如获取选择的节点

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年4月3日(星期一) 下午4:33 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wchbrad/vue-easy-tree] 根据data中的属性,隐藏checkbox (Issue #25)

使用render-content自定义内容,check-box根据data属性的需要渲染

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

wchbrad commented 1 year ago

或者你可以在需要不展示的节点使用disabledCheckbox: true,这个会是该节点不可选,但是会显示灰色的checkbox框

hu2014 commented 1 year ago

子节点禁用了之后,父节点就不能选择了哦

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年4月3日(星期一) 下午4:49 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wchbrad/vue-easy-tree] 根据data中的属性,隐藏checkbox (Issue #25)

或者你可以在需要不展示的节点使用disabledCheckbox: true,这个会是该节点不可选,但是会显示灰色的checkbox框

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

wchbrad commented 1 year ago

check-strictly="true"可以解决父节点不能选择的问题,但不能全选,推荐还是使用render-content然后自实现checkbox的选中和取消选中方法

hu2014 commented 1 year ago

有指定更新某个节点的方法吗

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年4月4日(星期二) 上午9:53 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wchbrad/vue-easy-tree] 根据data中的属性,隐藏checkbox (Issue #25)

check-strictly="true"可以解决父节点不能选择的问题,但不能全选,可以自己实现checkbox的选中和取消选中方法

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hu2014 commented 1 year ago

哈哈.对象是同一个对象。可以更改

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2023年4月4日(星期二) 上午9:53 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [wchbrad/vue-easy-tree] 根据data中的属性,隐藏checkbox (Issue #25)

check-strictly="true"可以解决父节点不能选择的问题,但不能全选,可以自己实现checkbox的选中和取消选中方法

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>