Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

element 树形结构使用问题。可以当成目录树理解,children相当于目录,可以一直往下分

element 树形结构使用问题。可以当成目录树理解,children相当于目录,可以一直往下分。types相当于文件 ,已经不可分。怎么el-tree的渲染出来
`

data:[
   name:'one'
   chidren:[
     {
        name:'',
        id:''
        type:[],
        children:[]
     },{
        name:'',
        id:''
        type:[],
        children:[]
     }
   ],
   types:[{
    name:'two',
    id:'12'
   },{
    name:'eeee',
    id:'12'
   }]

`


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

el-tree 是不支持这样的结构的。那么我们可以递归处理一下把types值push到children中。

https://www.lilnong.top/static/html/sf-q-1010000022739345-tree.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...