vue3+handsontable实现表格编辑导出

1、handsontable官网

https://handsontable.com/docs/#demo
https://www.npmjs.com/package/html-docx-js     // html转word
https://www.npmjs.com/package/file-saver  // 文件保存
https://www.npmjs.com/package/xlsx  

2、安装

npm install handsontable @handsontable/vue3
npm install file-saver --save
npm install html-docx-js --save
npm install xlsx --save

3、使用

<hot-table :settings="hotSettings" ref="hotTableComponent"></hot-table>

<script>
import { HotTable } from "@handsontable/vue3";
import { registerAllModules } from "handsontable/registry";
import "handsontable/languages/zh-CN"; //中文包
registerAllModules();

import * as XLSX from 'xlsx';
import htmlDocx from 'html-docx-js/dist/html-docx';
import saveAs from 'file-saver';

export default {
  components: {
    HotTable,
  },
  data() {
    return {
      hotSettings: {
        // data: [
        //   ["产品名称", null, "产品数据", null, null, "数据值", null],
        //   ["序号", "产品代号", "指标范围", "单位", "测量值", "设计值", "备注"],
        //   ["1", "0001", "1~1", "直径", "0.01", "0.001", "备注001"],
        //   ["2", "0002", "2~2", "压强", "0.02", "0.002", "备注002"],
        //   ["3", "0003", "3~3", "时间", "0.03", "0.003", "备注003"],
        //   ["4", "0004", "4~4", "高度", "0.04", "0.004", "备注004"],
        //   ["5", "0005", "5~5", "宽度", "0.05", "0.005", "备注005"],
        //   ["6", "0006", "6~6", "直径", "0.06", "0.006", "备注006"],
        //   ["7", "0007", "7~7", "时间", "0.07", "0.007"
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值