小程序
小游戏
企业微信
微信支付
扫描小程序码分享
swiper 来回左右滑动,滑动7,8次,就会卡死,官方的demo也一样,也会卡死
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
思路不对吧,这个跟图片是网络读取的还是本地提取的关系不大,应该是图片的渲染过程。你先这么做,整个页面里,使用纯净的swiper把容器写出来,再循环swiper-item数组,图片组件是images mode="widthFix",其他的一切对swiper的操作或事件脚本去掉,不监听滚动条
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
郁闷啊,
<
swiper
class
=
"swiper"
current
"{{currentTab}}"
duration
"200"
bindchange
"swiperChange"
bindanimationfinish
"animationfinish"
>
swiper-item
view
id
"fist-swiper-item"
>我是tab1---- index =1</
</
>我是tab2---- index =2</
>我是tab3---- index =3</
>我是tab4---- index =4</
>我是tab5----index = 5</
// swiper 滑动切换
swiperChange(e) {
console.log(e.detail.current,
'e.detail.current'
, e.detail,
'e.detail~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
)
console.log(
this
.data.currentTab,
'原来 this.data.currentTab-swiperChange~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`'
var
that =
if
(e.detail.source ==
'touch'
) {
(e.detail.current == 0 && that.data.currentTab > 1) {
that.setData({
currentTab: that.data.currentTab
})
}
else
(e.detail.current == 0 && that.data.currentTab == 1) {
wx.createSelectorQuery().select(
'#fist-swiper-item'
).boundingClientRect(
function
(rect) {
//rect.id // 节点的ID
//rect.dataset // 节点的dataset
//rect.left // 节点的左边界坐标
console.log(rect.left)
}).exec()
console.log(e)
currentTab: e.detail.current
{
},
swiper组件在持续优化中,感谢反馈
17年就开始有人提,到现在还在优化,也是够可以的
官方大佬,卡死是个很严重的问题啊
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
思路不对吧,这个跟图片是网络读取的还是本地提取的关系不大,应该是图片的渲染过程。你先这么做,整个页面里,使用纯净的swiper把容器写出来,再循环swiper-item数组,图片组件是images mode="widthFix",其他的一切对swiper的操作或事件脚本去掉,不监听滚动条
郁闷啊,
<swiperclass="swiper"current="{{currentTab}}"duration="200"bindchange="swiperChange"bindanimationfinish="animationfinish"><swiper-item><viewid="fist-swiper-item">我是tab1---- index =1</view></swiper-item><swiper-item><view>我是tab2---- index =2</view></swiper-item><swiper-item><view>我是tab3---- index =3</view></swiper-item><swiper-item><view>我是tab4---- index =4</view></swiper-item><swiper-item><view>我是tab5----index = 5</view></swiper-item></swiper>// swiper 滑动切换swiperChange(e) {console.log(e.detail.current,'e.detail.current', e.detail,'e.detail~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')console.log(this.data.currentTab,'原来 this.data.currentTab-swiperChange~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`')varthat =thisif(e.detail.source =='touch') {if(e.detail.current == 0 && that.data.currentTab > 1) {that.setData({currentTab: that.data.currentTab})}elseif(e.detail.current == 0 && that.data.currentTab == 1) {wx.createSelectorQuery().select('#fist-swiper-item').boundingClientRect(function(rect) {//rect.id // 节点的ID//rect.dataset // 节点的dataset//rect.left // 节点的左边界坐标console.log(rect.left)}).exec()console.log(e)that.setData({currentTab: e.detail.current})}else{that.setData({currentTab: e.detail.current})}}},swiper组件在持续优化中,感谢反馈
17年就开始有人提,到现在还在优化,也是够可以的
官方大佬,卡死是个很严重的问题啊