先占个坑

This commit is contained in:
aixianling
2024-01-29 10:32:11 +08:00
parent f82d7f58e7
commit 776539a32b
5 changed files with 62 additions and 34 deletions

View File

@@ -75,18 +75,20 @@ export default {
},
initStaticDataProps() {
const columnProp = "name"
this.options.staticData.map((row, i) => {
const prop = `c${i || ""}`
this.colConfigs.push({label: row[columnProp], prop})
Object.entries(row).map(([k, v]) => {
if (/^v/.test(k)) {
const item = this.tableData[k.substring(1) || 0] || {}
item[prop] = v
this.tableData[k.substring(1) || 0] = item
}
if (Array.isArray(this.options.staticData)) {
this.options.staticData.map((row, i) => {
const prop = `c${i || ""}`
this.colConfigs.push({label: row[columnProp], prop})
Object.entries(row).map(([k, v]) => {
if (/^v/.test(k)) {
const item = this.tableData[k.substring(1) || 0] || {}
item[prop] = v
this.tableData[k.substring(1) || 0] = item
}
})
})
})
this.tableData = this.tableData.map(e => ({...e, $cellEdit: false}))
this.tableData = this.tableData.map(e => ({...e, $cellEdit: false}))
}
}
},
created() {