<el-button @click="uploadtab" icon="el-icon-upload2">上传</el-button>
<input ref="excel-upload-input" style="display:none;" type="file" accept="" @change="handleClick" >
js
upload(rawFile) {
this.$refs['excel-upload-input'].value = null // fix can't select the same excel
// if (!this.beforeUpload) {
// return
// }
const formData = new FormData();
formData.append("file", rawFile);
this.formData = formData
console.log(this.formData,"990")
},
//文件上传
handleClick(e) {
const files = e.target.files
const rawFile = files[0] // only use files[0]
if (!rawFile) return
this.upload(rawFile)
// console.log(rawFile, "rawFile")
// console.log(this.formData,"this.formData")
generateVideo(
this.formData
).then(res => {
console.log(res)
})
},
//点击上传按钮
uploadtab() {
this.$refs['excel-upload-input'].click()
},