- 使用npm安装
npm install -S file-saver xlsx
npm install -D script-loader
2.下载两个包,很重要。
引入Blob.js和expor2Excal.js
不用直接导入。自动匹配吧(大概)
3. 导入
<!-- // 导入 -->
<el-upload
class="upload-demo"
action=""
:on-change="handleChange"
:show-file-list="false"
:on-remove="handleRemove"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
:auto-upload="false"
>
<el-button size="small" type="primary">批量上传</el-button>
<div slot="tip" class="el-upload__tip">
注:只 能 上 传 xlsx / xls 文 件
</div>
</el-upload>
下边这个需要放到methods
importfxx(obj) {
let _this = this;