1. scroll-view 无法触发 scrolltoupper、scrolltolower、scroll事件。
解决办法如下:
wxml代码:
<scroll-view
scroll-y = "true"
style="height: {{scrollHeight}}px;" // 切记 需要在这儿设置确定的高度值
bindscrolltoupper="upper"
bindscrolltolower="lower"
bindscroll="scroll"
scroll-into-view="{{toView}}"
scroll-top="{{scrollTop}}"
upper-threshold = "0"
lower-threshold = "0"
>
<view style='height:1000px'>123</view>
</scroll-view>
JS代码:
let scrollHeight1 = wx.getSystemInfoSync().windowHeight;
this.setData({
scrollHeight: scrollHeight1
});
scrollHeight是减去导航栏和tabbar的高度! 有点坑哈。
2. 小程序ios端不支持webp格式的图片。
解决办法:
data[i].content.middle_image.url = middle_image.url.replace('.webp', ".jpg")
把后台拿到的webp格式的图片通过格式后缀名替换成支持的格式即可。
如果是https://xxx.jpeg?%2Fformat%2Fwebp这种类型的链接,直接转换成https://xxx.jpeg即可。
网友评论