组件:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/extended/weui/uploader.html
WXML 代码:
<view class="page">
<view class="page__bd">
<mp-cells>
<mp-cell>
<mp-uploader bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uplaodFile}}" files="{{files}}" max-count="5" title="真实照片上传" tips="非真实照片将受到警告" delete="{{true}}"></mp-uploader>
</mp-cell>
</mp-cells>
</view>
</view>
JS 代码:
//...
/**
* 页面的初始数据
*/
data: {
files: ['cloud://cloud1-3g0985ox05f41f2d.636c-cloud1-3g0985ox05f41f2d-1307053970/cuser/od1W_5Wuu0W12WuS0-0gD4jchsew/1630378121140.jpg', 'cloud://cloud1-3g0985ox05f41f2d.636c-cloud1-3g0985ox05f41f2d-1307053970/cuser/od1W_5Wuu0W12WuS0-0gD4jchsew/1630378121141.jpg']
},
结果:
自问自答:页面上接收的格式是[{url:'xxxxxx'},{url:'xxxxx'}],所以保存进数据库也要这样存储,或者页面onload时处理数据成这样的格式