Astra GateEnglish

Tree

v2 插件界面组件 Tree(数据)的属性、子节点与示例

分组:数据 · 子节点:不接受子节点

属性

属性类型
nodesJSON
sourceJSON
expandedJSON
selectedJSON
selectionnone · single · multiple · checkbox
nodeActionsJSON
reorderable布尔
search布尔
indentsm · md · lg
dense布尔
empty节点
onSelect动作
onExpand动作
onReorder动作
onNodePress动作
onNodeAction动作
onSearch动作

另有所有组件都有的通用属性。动作类型的属性写动作名,或 { action, args }。

示例

组件画廊和两端比对用的就是这棵树:

代码json
{
  "type": "Tree",
  "props": {
    "nodes": [
      {
        "key": "src",
        "label": "src",
        "children": [
          {
            "key": "src/main.js",
            "label": "main.js",
            "detail": "2 KB"
          },
          {
            "key": "src/gateway.js",
            "label": "gateway.js",
            "badge": "hook"
          }
        ]
      },
      {
        "key": "locales",
        "label": "locales",
        "children": [
          {
            "key": "locales/en.json",
            "label": "en.json"
          },
          {
            "key": "locales/zh.json",
            "label": "zh.json"
          }
        ]
      },
      {
        "key": "astra.plugin.json",
        "label": "astra.plugin.json"
      }
    ],
    "expanded": [
      "src"
    ],
    "selected": [
      "src/main.js"
    ],
    "selection": "single",
    "onSelect": "select"
  }
}