收藏
回答

根据教程写了个swiper不能自适应宽度的问题

我是个新手跟着官方的教程写了个小程序测试,用到了swiper组件

但是他不能自适应手机宽度这个应该怎么解决呢?

index.wxml

<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}"  >
    <block wx:for="{{imgUrls}}">
     <swiper-item >
            <image src="{{item}}"  />
     </swiper-item>
    </block>
 </swiper>

index.js

data: {
   imgUrls: [
     'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
     'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
     'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
   ],
   indicatorDots: true,
   autoplay: true   
 },

显示效果却是这样的



我看了在iphone5上是正常的 其他手机上都不正常,请问这个应该怎么解决呢?

是我那里没有设置好吗?

希望知道的各位大虾指点下

感谢!

回答关注问题邀请回答
收藏

2 个回答

  • 2018-05-07

    建议看看image默认宽高属性

    2018-05-07
    有用
    回复
  • 熊志成
    熊志成
    2018-05-06

    作为小白的我建议楼主看一下开发文档中弹性盒子布局rpx相关的内容,可能会有帮助!

    2018-05-06
    有用
    回复
登录 后发表内容