js导出多个sheet的excel插件

1:安装

npm install @yck-web/more-sheet-excel -S

 

2:引入

import Derive from "@yck-web/more-sheet-excel";

 

3:使用(例子)

//第一个sheet
      let data1 = [{ name: "张三" }, { name: "里斯" }];
      let tHeader1 = [];
      let filterVal1 = [];
      tHeader1 = ["名字"];
      filterVal1 = ["name"];

      //第二个sheet
      let data2 = [{ name: "张三2" }, { name: "里斯2" }, { name: "王五" }];
      let tHeader2 = [];
      let filterVal2 = [];
      tHeader2 = ["名字2"];
      filterVal2 = ["name"];

      const excel = new Derive({
        bookType: "xlsx",
        filename: "项目信息",
        tHeader: [tHeader1, tHeader2],
        list: [data1, data2],
        autoWidth: [true],
        sheetName: ["sheet1", "sheet2"],
        filterVal: [filterVal1, filterVal2],
      });

 

适用于vue,react等工程化项目的前端导出excel

posted @ 2021-01-19 15:44  时光如瑾季微凉  阅读(802)  评论(0编辑  收藏  举报