这个问题困扰我好几天,网上各种写法也是非常的复杂,直到今天我才发现是我想复杂了。写法如下。
<el-upload
class="excel-btn"
:action="`${path}/excel/batchCreateDbDevice`"
:headers="{'x-token':token}"
:on-success="loadExcel"
:show-file-list="false"
>
<el-button style="margin:0 10px" size="mini" type="primary">批量导入</el-button>
</el-upload>
最后再重新获取一下表格数据
loadExcel() {
this.getTableData()
}
好啦,希望大家多多指教~