1. html模块
<el-button type="primary" @click="handleUpload" size="small" icon="el-icon-folder-add"> 报表导入</el-button>
<input id="excel-upload-input" type="file" accept=".xlsx, .xls" v-show="hide" @change="handkeFileChange">
2. 引用插件
import XLSX from 'xlsx';
3.
handleUpload() {
document.getElementById('excel-upload-input').click()
},
async handkeFileChange(e) {
var vm =this
vm.loadall= true
const files = e.target.files
const itemFile = files[0] // only use files[0]
const reader = new FileReader()
reader.onload = e => {
const data = e.target.result