关于image?

小程序 文章 2021-04-01 11:02 375 0 全屏看文

AI助手支持GPT4.0

关于image?About image?

关于image?

image组件无法显示图片,我设置了一些样式,然后图片地址是后端获取的,只有点开了图片之后才会正常显示是为什么

 <image class="{{index==xindex?'imageBanner':'imageBanner_small'}}data-index="{{index}}data-item="itembindtap="clickImgsrc="/uploads/cj/article/2021/04/01/f2b9489db529658d9122e50985cd3c3c.jpgwx:if="{{item.length>0}}"></image>

clickImg(res){

    console.log(res)

    var num=res.currentTarget.dataset.index

   wx.previewImage({

    urls:[this.data.banner[num]]

   })

}

点开了功能是显示原图

The image component can't display the image. I set some styles, and then the image address is obtained from the back end. Only when the image is opened can it be displayed normally. Why < image class = {{index = = xindex?'imagebanner ':'imagebanner'_ small'}}" data-index="{{index}}" data-item="item" bindtap="clickImg" src="/uploads/cj/article/2021/04/01/f2b9489db529658d9122e50985cd3c3c.jpg" wx:if="{{ item.length >0}}"> clickImg(res){ console.log (res) var num= res.currentTarget.dataset .index wx.previewImage ({ urls:[ this.data.banner The function is to display the original image

回答:

this:

你这个item是什么

Clover_Xu:看我的回复,补充了
Clover_Xu:

<swiper class='bannerSwiperprevious-margin="54rpxnext-margin='54rpxindicator-dots="trueindicator-color='#B5B5B5indicator-active-color='#fffinterval='3000duration='500bindchange='onChangecircular='true'>

      <block wx:for="{{banner}}wx:key="index">

        <swiper-item>

          <image class="{{index==xindex?'imageBanner':'imageBanner_small'}}data-index="{{index}}data-item="itembindtap="clickImgsrc="/uploads/cj/article/2021/04/01/f2b9489db529658d9122e50985cd3c3c.jpgwx:if="{{item.length>0}}"></image>

        </swiper-item>

      </block>

    </swiper>

这是补充的内容,是一个轮播图


Clover_Xu:data: {
   
    banner: [src, src1,src2],
    xindex: 0,
}
😮😮:

你的item是什么东西啊

Mr.Zhao:

没理解

Clover_Xu:就是我设置了一个轮播图,但是不显示,只有点图片后才能正常显示
Mr.Zhao:跟没说一样,写个代码片段出来
Clover_Xu:看回复,已补充
Mr.Zhao:看回复?你逗大家玩呢?banner: [src, src1,src2]  这个咋运行?
Clover_Xu:我后面是用setdata赋值,这个不用管,后面banner里有地址,点开预览也是可行
Clover_Xu:看问题上贴的图,我有必要逗大家玩?我是测试过,banner里面有值才问的问题

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
查询云数据库时,电脑端正常拿到数据并显示,但是手机端没有数据? 在线等解决,非常感谢。
企业微信获取考勤中的请假信息,如请假类别,请假时长,请假事由,这个有相关API吗,如何实现
怎么发帖?
想在本js中使用刚从数据库读取的值该怎样处理,想要的值如图二?
开放平台一进入第三方平台就提示错误是为什么呢?
随便看看
我的小程序测试appid用不了云开发? 846
在后台调用getuserphonenumber接口一直报错,是不能在后台用吗? 688
微信小程序wxss可以动态的用js的值吗?怎么传? 617
小程序商城可以上架电子茶吗?虽然与电子烟类似,但是原料是萃茶叶的精华的元素茶多酚 324
请问小程序数据助手的appId是多少? 295
请不要随意封禁公众号好吗,我已经失眠好几天了!? 331
这个关于渲染图片的报错是怎么回事? 326
初学者想问一下为什么同样从接口里拿到的数据有的可以显示有的不行? 350
社区的账号绑定了企业账号,切换回个人账号后,回复的主体还是显示企业账号? 306
商业收款码审核七天还未完? 469