yyzone-bip
Version:
升级新的ui标准后的yyzone库
61 lines • 1.47 kB
JavaScript
export default {
inject: [ 'tableRoot' ],
props: {
type: { // td, th, expand
type: String,
default: 'td'
},
columns: {
type: Array,
default() {
return []
}
},
column: {
type: Object,
default() {
return {}
}
},
index: {
type: Number
},
data: {
type: [Object, String, Number, Array, Boolean],
default: ''
},
row: {
type: Object,
default: () => ({})
},
},
render(h) {
return this[this.type](h);
},
methods: {
th(h) {
return h('th', {
class: this.column.id
}, [
this.column.renderTableHeader(h)
])
},
td(h) {
return h('td', {
class: this.column.id
}, [
this.column.renderTableCell(h, this.row, this.data, this.index)
])
},
expand(h) {
return h('td', {
class: this.column.id,
attrs: {
colspan: this.columns.length
}
}, [
this.column.renderTableExpand(h, this.row, this.data, this.index)
])
}
}
}