同标题,但在caniuse上查询在safari浏览器中并无兼容问题。相关代码:letinput=document.createElement('input');letformData=newFormData();input.type='file';input.setAttribute('accept','image/*');input.addEventListener('change',function(){letfile=this.files[0];alert(file.name)formData.append('file',file);letloading=weui.loading('loading');axios({lmethod:'post',url:url,data:formData,headers:{'Access-token':token}}).then(function(data){xxx})});input.click();
2 回答
FFIVE
TA贡献1797条经验 获得超6个赞
貌似IOS也不支持formData的gethasdelete,刚刚遇到此坑varformData=newFormData();//这几段Ios运行不了if(formData.has("images")){formData.delete("images")}elseif(formData.has("content")){formData.delete("content")}但是append操作还是可以的formData.append("content",'test');
添加回答
举报
0/150
提交
取消