vxe-table-plugin-excel
TypeScript icon, indicating that this package has built-in type declarations

1.6.0 • Public • Published

vxe-table-plugin-excel

gitee star npm version npm downloads gzip size: JS gzip size: CSS npm license

基于 vxe-table 2.x 表格的增强插件,实现简单的 Excel 表格(实验功能,仅供参考)

Installing

npm install xe-utils vxe-table vxe-table-plugin-excel
// ...
import VXETablePluginExcel from 'vxe-table-plugin-excel'
import 'vxe-table-plugin-excel/dist/style.css'
// ...
 
VXETable.use(VXETablePluginExcel)

Demo

<vxe-excel
  ref="xExcel"
  max-height="600"
  :columns="columns"
  :data="tableData">
</vxe-excel>
export default {
  data () {
    let columns = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N']
    return {
      columns: [
        {
          type: 'index',
          width: 50,
          align: 'center',
          headerAlign: 'center'
        }
      ].concat(columns.map(name => {
        return {
          field: name,
          title: name,
          minWidth: 76,
          headerAlign: 'center',
          editRender: {
            name: 'cell'
          }
        }
      })),
      tableData: Array.from(new Array(20)).map((num, index) => {
        let item = {}
        columns.forEach(name => {
          item[name] = ''
        })
        return item
      })
    }
  }
}

License

MIT © 2019-present, Xu Liangzhan

Dependents (2)

Package Sidebar

Install

npm i vxe-table-plugin-excel

Weekly Downloads

16

Version

1.6.0

License

MIT

Unpacked Size

74.4 kB

Total Files

11

Last publish

Collaborators

  • x-extends