一、安装三个依赖包
npm install -S file-saver
npm install -S xlsx
npm install -D script-loader
二、 按照图中路径把Blob.js和 Export2Excel.js这两个文件夹放到文件夹内
Blob.js源码地址 https://github.com/eligrey/Blob.js/blob/master/Blob.js
Export2Excel.js 源码
/* eslint-disable */
require('script-loader!file-saver');
require('script-loader!@/vendor/Blob');
require('script-loader!xlsx/dist/xlsx.core.min');
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C