@marv1n/vxe-table-plugin-export-xlsx
v0.0.1
Published
(为项目特殊需求改写,仅内部使用) 基于 vxe-table 的表格插件,支持导出 xlsx 格式
Downloads
3
Readme
vxe-table-plugin-export-xlsx
基于 vxe-table 的表格插件,支持导出 xlsx 格式,基于 exceljs 实现
Installing
npm install xe-utils vxe-table vxe-table-plugin-export-xlsx exceljs
// ...
import VXETable from 'vxe-table'
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-column type="seq" width="60"></vxe-column>
<vxe-column field="name" title="Name"></vxe-column>
<vxe-column field="age" title="Age"></vxe-column>
<vxe-column field="date" title="Date"></vxe-column>
</vxe-table>
export default {
data () {
return {
tableData: [
{ id: 100, name: 'test', age: 26, date: null },
{ id: 101, name: 'test1', age: 30, date: null },
{ id: 102, name: 'test2', age: 34, date: null }
]
}
},
methods: {
exportEvent() {
this.$refs.xTable.exportData({
filename: 'export',
sheetName: 'Sheet1',
type: 'xlsx'
})
}
}
}
License
MIT © 2019-present, Xu Liangzhan