When getting the file in input in the vue project, an error occurs:
input code:
<el-form-item label="图片:">
<el-input v-model="form.file" type="file" id="file"></el-input>
</el-form-item>
Get the selected file code snippet:
var a = document.getElementById("file").files[0];
The following errors occur, but do not affect the operation of the project:
Solution:
var a = document.getElementById("file")["files"];
console.log(a[0])
In this way, the error is gone.