Skip to content

可否在 treeview 组件中使用自定义节点内容? #2972

@ghost

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

可以在树形组件的 props 中添加自定义节点属性,支持 vnode,或者在插槽中添加也可以的

What does the proposed API look like?

<template>
    <a-tree
        :render-node="myRender"
        :tree-data="xxx" >
    </a-tree>
</template>

<script>
   export default {
           setup ()   {
                  // xxxx 为 此节点的属性
                 function myRender   (xxxx) {
                          let { x1  , x2 , x3 }=xxxx
                           if (x1==='apple') {
                                 retuen ......
                           } else {
                                 retuen ......                                 
                          } 
                 }
                  
                 return { myRender } 
           }
    

   }
</script>
```t>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions