需要读取element ui组件上传上来的文件内容,然后判断,但是怎么都读取不到内容
<el-upload
class="upload-demo"
ref="upload"
action="api/cgi-bin/SystemUpgradeUploadNet16File.cgi?"
accept=".bin"
:on-remove="handleRemove"
:file-list="fileList"
:on-change="loadJsonFromFile"
:auto-upload="false"
:on-success="success"
:limit="1"
>
<el-button size="small" class="colb" slot="trigger" type="primary">选取文件
</el-button>
<span class="tile"> {{b}} </span>
</el-upload>
success(response){
console.log(this.$refs.upload.fileList[0])
var reader = new FileReader();
reader.readAsArrayBuffer(this.$refs.upload.fileList[0]);
reader.onloadend = function() {
console.log(reader.result)
};
if(response.indexOf("has been uploaded") >= 0){
alert("扩展板系统升级文件上传成功!");
}else {
alert("扩展板系统升级文件上传失败!");
}
},
文件可以拿到,但是读取不到内容