This commit is contained in:
yanran200730
2023-03-15 16:10:33 +08:00
parent 529e0ddccf
commit fe682e7a2b
3 changed files with 7 additions and 11 deletions

View File

@@ -85,7 +85,6 @@
methods: {
init (value) {
console.log(this.config)
if (!value.length) {
this.header = []
this.body = []
@@ -95,24 +94,19 @@
const headerKey = Object.keys(value[0])[0]
const bodyKey = Object.keys(value[0]).filter(v => {
return v !== headerKey && ['color', 'width', 'align'].indexOf(v) === -1
return v !== headerKey
})
this.header = value.map(v => {
return {
v: v[headerKey],
align: v.align,
width: Number(v.width || 0) ? (Number(v.width || 0) + (this.isShowIndex === '1' ? 0 : 0)) : ''
v: v[headerKey]
}
})
this.body = bodyKey.map(v => {
return value.map(e => {
return {
v: e[v],
color: e.color,
align: e.align,
width: e.width || ''
v: e[v]
}
})
})