When you use el-tree scope-lot in elment-ui to customize node content rendering, only your own label and id can render

when you use el-tree scope-lot in element-ui to customize node content rendering, only your own label and id can render, but not your own.

                                <el-tree
                                    :data="data5"
                                    show-checkbox
                                    node-key="id"
                                    default-expand-all
                                    :expand-on-click-node="false">
                <span class="custom-tree-node" slot-scope="{ node, data }">
                    <span>{{ node.label }}</span>
                    <span>{{ node.label }}</span>
                </span>
                            </el-tree>
                          
                            
    

clipboard.png

clipboard.png

 data5: [{
                    id: 1,
                    label: " 1",
                    name: "1",
                    children: [{
                        id: 4,
                        label: " 1-1",
                        name: "2",

                        children: [{
                            id: 9,
                            label: " 1-1-1",
                            name: "3"
                        }, {
                            id: 10,
                            label: " 1-1-2",
                            name: "4"
                        }]
                    }]
                }, {
                    id: 2,
                    label: " 2",
                    name: "5",

                    children: [{
                        id: 5,
                        label: " 2-1",
                        name: "6",

                    }, {
                        id: 6,
                        label: " 2-2",
                        name: "7",

                    }]
                }, {
                    id: 3,
                    label: " 3",
                    name: "8",

                    children: [{
                        id: 7,
                        label: " 3-1",
                        name: "9",

                    }, {
                        id: 8,
                        label: " 3-2",
                        name: "10",

                    }]
                }],
                dialogFormVisible: false,
                dialogFormVisible1: false,
                formLabelWidth: "120px",

                ruleForm: {
                    name: "",
                    roleType: "",
                    options1: [{
                        value: "1",
                        label: ""
                    }, {
                        value: "2",
                        label: ""
                    },],
                    user: "admin0",
                    description: ""
                },
Feb.27,2022

you can write this:


                <span>{{ node.label }}</span>
                <span>{{ data.name }}</span>
                </span>
    </el-tree>
Menu