The tree component of element-ui can be selected by default when it is rendered to true, according to the checked attribute of data data. For more information, please refer to it.

ask how to set whether to expand and select nodes by default according to the expanded and checked attributes of publish_treeData data. For example, disabled: true can disable the state

.
<el-tree
    :data="publish_treeData"
    show-checkbox
    node-key="id"
    :default-expanded-keys="defaultExpandedKeys"
    :default-checked-keys="defaultCheckedKeys"
    @setChecked="setCheckedFunc">
</el-tree>
 publish_treeData: [{
                id: 1,
                label: " 2",
                children: [{
                    id: 3,
                    label: " 2-1",
                    children: [{
                        id: 4,
                        label: " 3-1-1"
                        }, {
                        id: 5,
                        label: " 3-1-2",
                        expanded: true,
                        checked: true,
                        disabled: true
                    }]
                }],
Mar.22,2021

traverse your data, settings defaultCheckedKeys


just take a look at api. Generally, you want to find a function directly in api. If you don't have it, you can't do it, or you can only think of your own way to achieve it.

Menu