在uni-app开发,append后数据没有显示的解决方法?

小程序 文章 2021-02-04 14:21 2330 0 全屏看文

AI助手支持GPT4.0

在uni-app开发,append后数据没有显示的解决方法?In uni-app development, the data is not displayed after append?

在uni-app开发,append后数据没有显示的解决方法?

如图,想选择文件后将它append进formdata里,结果打印出来数据都为空的,请问这是什么原因呢?

As shown in the figure, if you want to select a file and append it to formdata, the result will print out that the data is empty. What is the reason?

回答:

铅笔画不出蜡笔的味道:

https://ask.dcloud.net.cn/explore/category-12

去这里提问吧

柠檬鲸科技:
var fData = []fData.push({file:res.tempFiles[0]})


用数组的push吧,再就是去看下FormData的语法吧

//通过FormData构造函数创建一个空对象var formdata=new FormData();//可以通过append()方法来追加数据formdata.append("name","laotie");//通过get方法对值进行读取console.log(formdata.get("name"));//laotie//通过set方法对值进行设置formdata.set("name","laoliu");console.log(formdata.get("name"));//laoliu





oneGod:

我记得formdata打印出来都是空的,不管你添加没添加进去打印出来都空。但是可以遍历打印出key和value

-EOF-

AI助手支持GPT4.0