1. vxe-table-plugin-export-xlsx
基于 vxe-table 表格的扩展插件,支持导出 xlsx 格式
vxe-table-plugin-export-xlsx
Package: vxe-table-plugin-export-xlsx
Created by: x-extends
Last modified: Wed, 31 Jan 2024 00:20:44 GMT
Version: 4.0.1
License: MIT
Downloads: 10,990
Repository: https://github.com/x-extends/vxe-table-plugin-export-xlsx

Install

npm install vxe-table-plugin-export-xlsx
yarn add vxe-table-plugin-export-xlsx

vxe-table-plugin-export-xlsx

gitee star
npm version
npm downloads
npm license

基于 vxe-table 的表格插件,支持导出 xlsx 格式,基于 exceljs 实现

Compatibility

对应 vxe-table v4 版本

Installing

 npm install vxe-table@next vxe-table-plugin-export-xlsx@next exceljs
 // ...
import VXETable from 'vxe-table'
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
import ExcelJS from 'exceljs'
// ...

// 方式1:NPM 安装,注入 ExcelJS 对象
VXETable.use(VXETablePluginExportXLSX, {
  ExcelJS
})

// 方式2:CDN 安装,只要确保 window.ExcelJS 存在即可
// 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

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin