sk-vxe-table-plugin-export-xlsx
v2.1.0
Published
基于 vxe-table 的表格插件,支持导出 xlsx 格式
Downloads
1
Readme
vxe-table-plugin-export-xlsx
基于 vxe-table 的表格插件,支持导出 xlsx 格式,依赖 exceljs 库
Installing
npm install xe-utils vxe-table vxe-table-plugin-export-xlsx exceljs
// ...
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
// ...
VXETable.use(VXETablePluginExportXLSX)
Demo
<vxe-toolbar>
<template v-slot:buttons>
<vxe-button @click="exportEvent">导出.xlsx</vxe-button>
</template>
</vxe-toolbar>
<vxe-table
ref="xTable"
height="600"
:data="tableData">
<vxe-table-column type="index" width="60"></vxe-table-column>
<vxe-table-column field="name" title="Name"></vxe-table-column>
<vxe-table-column field="age" title="Age"></vxe-table-column>
<vxe-table-column field="date" title="Date"></vxe-table-column>
</vxe-table>
export default {
data () {
return {
tableData: [
{
id: 100,
name: 'test',
age: 26,
date: null
}
]
}
},
methods: {
exportEvent() {
this.$refs.xTable.exportData({
filename: 'export',
sheetName: 'Sheet1',
type: 'xlsx'
})
}
}
}
License
MIT © 2019-present, Xu Liangzhan