微信小程序图片上传?

小程序 文章 2021-03-01 21:42 336 0 全屏看文

AI助手支持GPT4.0

微信小程序图片上传?Upload pictures on WeChat applet?

微信小程序图片上传?

各位社区的小伙伴你们好 我现在做开发遇到了一个问题一直没有解决  就是关于图片上传这一块的技术相关问题 我对接了相关的接口 我第一次上传的图片是没有问题的 再次进入图片上传的页面能显示并且我点击了保存按钮将相关的图片路径放到了数据库中 但是我再次点击图片上传按钮时再上传一张照片时点击保存按钮 下次再进入该页面就发现第二次上传的一张图片还是有的 第一次上传的就没有了 我是想要这个的结果的 第一次我点击图片上传按钮上传三张照片点击保存按钮下次进入页面时这三张图片还是有显示的 但我点击第二次上传图片按钮时再次上传三张 页面上一共六张图片我点击了保存按钮下次再进这个页面只有第二次上传的三张照片是什么情况呢 不应该是六张吗?

Hello, community friends, I now do development encountered a problem has not been solved, is about the picture upload this piece of technology related problems, I docking the relevant interface, the first time I upload the picture is no problem, again into the picture upload page can be displayed, and I click the Save button to put the relevant picture path into the database But when I click the image upload button again, when I upload a picture again, I click the Save button. When I enter the page next time, I find that there is still a picture uploaded for the second time, but there is no picture uploaded for the first time. I want this result. The first time I click the image upload button to upload three pictures, and then click the Save button. When I enter the page next time, these three pictures are still displayed But when I click the upload picture button for the second time, I upload six pictures on three pages again. I click the Save button. Next time I enter this page, I only upload three pictures for the second time. What's the situation? Shouldn't it be six?

回答:

 触摸不到的远方:

加油:咋样,解决了吗
默垂眸:

用这个发下代码片段 (千万别在发给我截图了)

https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

加油:

是不是onShow 的时候清空了图片数组或者是没有将新上传的图片push 进去(ps:眼睛快瞎了,代码会好很多)

Brother斌🎈:

这不是你接口数据存取的问题吗(ps:这样发问题看得很累,眼睛快瞎了)

Mr.Zhao:

别用文字描述了,很乱,不知道讲啥,亮代码吧

 触摸不到的远方:
Mr.Zhao:你这个代码有个异步问题
 触摸不到的远方:啥异步问题
Mr.Zhao:第二张图的for循环,不是按顺序执行的
 触摸不到的远方:没有啊
Mr.Zhao:没有啥?
Mr.Zhao:问题描述也乱糟糟的,看的头晕

-EOF-

AI助手支持GPT4.0