HLJ 发布于
2019-01-25 10:41:59

element tree树组件default-expanded-keys属性设置默认展开的节点

default-expanded-keys值可以设置指定节点展开关闭状态

html代码:

<el-tree
    :data="speNodeData"
    :expand-on-click-node="true"
    :check-on-click-node="true"
    node-key="id"
    ref="tree"
    accordion
    :default-expand-all="false"
    default-expanded-keys="['a123','b123']"
    :highlight-current="true"
    :props="defaultProps"
    @node-click="clickNode">
</el-tree>

数据结构:

[
    {
        "id":"a123",
        "label":"树1",
        "isNode":null,
        "moduleId":null,
        "relationType":null,
        "ralationTypeId":null,
        "orderNum":0,
        "parentId":null,
        "children":[]
    },
    {
        "id":"b123",
        "label":"树2",
        "isNode":null,
        "moduleId":null,
        "relationType":null,
        "ralationTypeId":null,
        "orderNum":0,
        "parentId":null,
        "children":[]
    }
]

效果图:


当前文章内容为原创转载请注明出处:http://www.good1230.com/detail/2019-01-25/341.html
最后生成于 2024-05-23 22:50:20
此内容有帮助 ?
0