-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
The way the tree control customizes the display content is too cumbersome #4256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
举个例子?自定义的展示内容的话title插槽应该就够了 |
代码中使用treeData赋值
比如接口返回数据只是有关业务的,其中有些项点击后在右侧布局没有直接内容,就想根据当前项的另一个属性进行判断,在树上用不同颜色标识或者当前项禁止点击。 BTW
是否可以把这种方案加到文档之中? |
https://2x.antdv.com/components/tree-cn#components-tree-demo-context-menu 参考一下这个右键菜单的demo,title是全局的slot,每一项都会生效的 |
这个是2.x的,title在Tree props,应该是没问题的; 在1.x中准备增加这一项吗? |
需要的话我可以提个pr,这个还是比较经常用到的,所以我2.x给加上了 |
嗯是的。如果没在计划内的话,我也可以提交pr。 还有请看一下这两个问题
|
TreeSelect 的 title 也不支持全局定义 slot,而且如果数据中有 title 属性,scopedSlots 也会失效。 参看 issues 连接: #2826 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What problem does this feature solve?
一般原始数据都是比较纯粹的数据。想要自定义树控件内部的显示内容,必须要对treeData的每一项遍历加上要求的属性,太繁琐。
为什么不提供一个系统默认的插槽呢?对树内部的自定义渲染会简化好多
What does the proposed API look like?
无论是通过render()函数,还是通过插槽,体验都好
The text was updated successfully, but these errors were encountered: