Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiper组件仅有一张图片时候,在iOS 下 点击页面 变空白 #1559

Closed
litoxy opened this issue Jun 13, 2017 · 2 comments
Closed

Comments

@litoxy
Copy link

litoxy commented Jun 13, 2017

  <swiper loop :aspect-ratio='ratio' dots-position="center" :show-desc-mask="showmask" :list="getImgs()"  v-if="goodsdetail.imgs.length>0" ></swiper>

getImgs定义如下:

getImgs:function () {
        let bannerList = this.goodsdetail.imgs.map((one, index) => ({
          url: '#',
          img: one
        }))

        return bannerList;
      },

getDetail:function () {
          let _this = this;
        this.ajax.post('store/getimglist',{"goodsid":this.goodsid})
          .then(function (res) {
            _this.goodsdetail = res.data.data.pinfo;
          }).catch(function (err) {
            console.log(err)
          })
      }

如果 接口 store/getimglist 返回的 imgs 值有一条数据 如:

{
  "status": "200",
  "message": "\u6210\u529f",
  "data": {
    "pinfo": {
      "inventorynum": 99999,
      "state": 1,
      "piid": "107",
      "imgs": [
        "https:\/\/aimgstoreapi.moveclub.cn\/uploads\/image\/20170613\/593fa100c3970.jpg"
      ],
      "tips": "\u7acb\u5373\u8d2d\u4e70",
      "canpurchase": 1
    }
  }
}

则在IOS下 点击 页面 会变成空白

@airyland
Copy link
Owner

如果你只有一张图片加上你 v-if 的条件,肯定不会显示出来了。

@litoxy
Copy link
Author

litoxy commented Jun 13, 2017

@airyland 那会正在编辑issues不小心提交了
如果只有一张图片 会正常显示。但是 如果点击下页面 整个页面会变成空白

你太迅速了.
最后,自己解决方案是判断 图片数量 如果是一张的话 直接 显示图片 不用swiper组件。
多张的话使用swiper组件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants