Disguise the drop-down box of select components in elementui as a tree structure

as shown in the question

        options2: [{
          value: "1",
          label: "",
          level:3
        }, {
          value: "2",
          label: "",
          disabled: true,
          level:2
        }, {
          value: "3",
          label: "",
          level:5
        }, {
          value: "4",
          label: "",
          level:2
        }, {
          value: "5",
          label: "",
          level:5
        }],
        value2: ""
      }
    }

the above is the data in select. How to judge how to add a few spaces before the data displayed in option according to the level field, for example, if level is 5, then there will be five spaces before the words of Beijing Roast Duck. The drop-down box made in this way is similar to the tree chart for guidance.

Apr.03,2021

https://jsfiddle.net/7dopkugq.


components modified based on el-select, learn about https://blog.csdn.net/Mr_Java.

Menu