通过手动调用 exportData 方法可以直接导出文件,导出时单元格类型默认是自动转换的,如果是需要字符串类型,可以通过 column.cell-type 设置,也可以调用 openExport 方法打开导出面板
官网: https://vxetable.cn- npm install vxe-pc-ui@4.3.2 vxe-table@4.9.3 @vxe-ui/plugin-export-xlsx@4.0.7 exceljs@4.2.1
复制代码- [/code][code]// ...
- import { VxeUI } from 'vxe-pc-ui'
- import VxeUIPluginExportXLSX from '@vxe-ui/plugin-export-xlsx'
- // ...
- // 确保 window.ExcelJS 变量存在即表示安装完成
- VxeUI.use(VxeUIPluginExportXLSX)
复制代码
- <template>
-
- <vxe-button @click="exportEvent">高级导出</vxe-button>
- <vxe-table
- border
- show-footer
- ref="tableRef"
- :export-config="{type: 'xlsx'}"
- :data="tableData"
- :merge-cells="mergeCells"
- :footer-data="footerData">
- <vxe-column field="seq" type="seq" width="70"></vxe-column>
- <vxe-colgroup title="分组1">
- <vxe-column field="name" title="Name"></vxe-column>
- <vxe-column field="role" title="Role"></vxe-column>
- </vxe-colgroup>
- <vxe-column field="sex" title="Sex"></vxe-column>
- <vxe-column field="age" title="Age"></vxe-column>
- </vxe-table>
-
- </template>
复制代码 https://github.com/x-extends/vxe-table
来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |