vue3使用arco的树(tree)组件自定义node结点显示

使用arco.design组件

<a-tree
    :data="treeData"
    :default-expanded-keys="['0-0-0']"
    :default-selected-keys="['0-0-0', '0-0-1']"
  >
    <template #extra="nodeData">(20{{ nodeData.title }})</template>
  </a-tree>

变量定义 setup中

const treeData = [
  {
    title: 'Trunk 0-0',
    key: '0-0',
    children: [
      {
        title: 'Branch 0-0-0',
        key: '0-0-0',
        disabled: true,
        children: [
          {
            title: 'Leaf',
            key: '0-0-0-0',
          },
          {
            title: 'Leaf',
            key: '0-0-0-1',
          }
        ]
      },
      {
        title: 'Branch 0-0-1',
        key: '0-0-1',
        children: [
          {
            title: 'Leaf',
            key: '0-0-1-0',
          },
        ]
      },
    ],
  },
];

完成结果
在这里插入图片描述


版权声明:本文为AIB_Kasic原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。