no message
Former-commit-id: 8ba996eb2dbe794b7e1162c48b02488521f7553f Former-commit-id: 7e2450ef2cd0607d8609a26c150cc8537911c5b7 Former-commit-id: 437f88a1aba7be735f85017831b6a46c09ad7776
This commit is contained in:
@@ -49,7 +49,10 @@ export default {
|
||||
})
|
||||
},
|
||||
exportExcel () {
|
||||
this.$export.excel()
|
||||
this.$export.excel({
|
||||
columns: this.table.columns,
|
||||
data: this.table.data
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,19 @@ export default {
|
||||
})
|
||||
},
|
||||
// 导出 Excel
|
||||
excel () {
|
||||
const tHeader = ['Id', 'Title', 'Author', 'Readings', 'Date']
|
||||
const data = [
|
||||
['1', 'name']
|
||||
]
|
||||
Excel.export_json_to_excel(tHeader, data, 'demo')
|
||||
excel (params) {
|
||||
// 默认值
|
||||
const paramsDefault = {
|
||||
columns: [],
|
||||
data: []
|
||||
}
|
||||
// 合并参数
|
||||
const _params = Object.assign({}, paramsDefault, params)
|
||||
// 从参数中派生数据
|
||||
const header = _params.columns.map(e => e.label)
|
||||
const data = _params.data.map(row => _params.columns.map(col => row[col.prop]))
|
||||
// 导出 Excel
|
||||
Excel.export_json_to_excel(header, data, 'demo')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user