先安装XLSX:npm install xlsx
导入:import XLSX from 'xlsx'
这里有两种方式:readAsBinaryString和readAsArrayBuffer
readAsBinaryString方式:
<el-upload
ref="upload"
:action="CommitURL"
:auto-upload="false"
:on-change="importf"
:show-file-list="false"
:multiple="false">
<el-button type="primary">点击上传</el-button>
</el-upload>
checkFileType(file, fileList) {
const _file = file.raw;
const fileReader = new FileReader();
fileReader.onload = (ev) => {
try {
const data = ev.target.result;
const wor