<input ref='uploadInput' type="file" class="dl-none" name="icon" @change="dealfilechange" />
<CustomButton type="plain" color="color-primary" class="ml-2" @click="uploadgogo" >导入</CustomButton>
const dealfilechange = (e: Event) => {
const input = e.target as HTMLInputElement;
let files = input.files;
if (files) {
const formData=new FormData();
formData.append(files[0].name,files[0])
importfile(formData)
}
}
const uploadgogo = ()=>{
// console.log(uploadInput.value)
let oBtn = uploadInput.value as HTMLInputElement;
oBtn.click();
}
发送参数
后台返回
是参数格式错误吗?应该怎么写?
formData.append('file',files[0])