云开发渲染轮播图,不知道为什么渲染不出来?

小程序 文章 2022-03-03 09:40 458 0 全屏看文

AI助手支持GPT4.0

云开发渲染轮播图,不知道为什么渲染不出来?Cloud development rendering carousel, I don't know why it can't be rendered?

云开发渲染轮播图,不知道为什么渲染不出来?
<swiper>    <swiper-item  wx:for="{{image}}"  wx:key="id">          <image src="/uploads/cj/article/2022/03/03/7e344b94cce1d073ffe3a2d379f420ce.jpg"></image>    </swiper-item></swiper>


wx.cloud.database().collection('banner').get({      success: function(res) {        // res.data 包含该记录的数据        console.log("图片记录",res)        console.log(res.data)        that.setData({          image:res.data        })      }          })

                   wx.cloud.database().collection('banner').get({      success: function(res) {        // res.data 包含该记录的数据        console.log("图片记录",res)        console.log(res.data)        that.setData({          image:res.data        })      }          })

回答:

老张:
1、能不用cloudID就不用cloudID,换成wx.cloud.getTempFileURL


我我我我我我想:试了下 好像不行
15:

感觉你的json结构有点奇怪啊。that.setData里面改成 image:res.data[0],src="/uploads/cj/article/2022/03/03/7e344b94cce1d073ffe3a2d379f420ce.jpg" 改成 src="/uploads/cj/article/2022/03/03/f2b9489db529658d9122e50985cd3c3c.jpg" 试试。而且最好不要都命名为image吧,逻辑容易乱,for循环那里可以命名为images啊

我我我我我我想:我试试,昨晚改了一下能显示一张图片;下面这样能显示一张图片 就是不循环
我我我我我我想:

单独图片链接我试了,可以渲染出来,就是从云数据库拿图片,渲染不出来,而且还报错

-EOF-

AI助手支持GPT4.0