之前上传的图片存在云数据库的集合里,集合叫merchandise,字段是fileIDs,然后fileIDs是个数组,存有多张图片。请问如何才能将这些图片都渲染到页面?试过了很多种写法都没有成功,请大家指教,非常感谢!
wxml:
<view class="photo">
<block wx:for="{{goods}}" wx:key="_id">
<image src='{{item.fileIDs}}' mode='widthFix' bindtap="preview"></image>
</block>
</view>
js:
data: {
goods:[],
},
onLoad: function (options) {
id = options.id
wx.cloud.database().collection('merchandise')
.doc(id)
.get()
.then(res=>{
this.setData({
goods:res.data
})
console.log('请求到的数据',res)
})
.catch(err=>{
})
},