vue导出excel

//导出excel 用到了xlsx
/import XLSX from 'xlsx'
const outputXlsxFile = (data, wscols, xlsxName) => {
/!
convert state to workbook *!/
const ws = XLSX.utils.aoa_to_sheet(data);
ws['!cols'] = wscols;

const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, xlsxName);
/!* generate file and send to client !/
XLSX.writeFile(wb, xlsxName + ".xlsx");
}
Vue.prototype.$outputXlsxFile = outputXlsxFile;
/

你可能感兴趣的:(vue导出excel)