//利用element-ui的 属性,在插入多级表格
{ {scope.$index}}
{ {scope.row[column.value]}}
name:'treeTable',
props: {
data: {
type: [Array, Object],
required:true},
columns: {
type: Array,default: ()=>[]
},
evalFunc: Function,
evalArgs: Array,
expandAll: {
type: Boolean,default:false}
},
computed: {//格式化数据源
formatData:function() {
let tmpif(!Array.isArray(this.data)) {
tmp=[this.data]
}else{
tmp= this.data
}
const func= this.evalFunc||treeToArray
const args= this.evalArgs?Array.concat([tmp,this.expandAll],this.evalArgs) : [tmp,this.expandAll]returnfunc.apply(null, args)
}
},
methods: {
showRow:fun