小程序
小游戏
企业微信
微信支付
扫描小程序码分享
swiper 来回左右滑动,滑动7,8次,就会卡死,官方的demo也一样,也会卡死
2 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
郁闷啊,
<
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
class
=
"swiper"
current
=
"{{currentTab}}"
duration
=
"200"
bindchange
=
"swiperChange"
bindanimationfinish
=
"animationfinish"
>
<
swiper-item
>
<
view
id
=
"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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`'
)
var
that =
this
if
(e.detail.source ==
'touch'
) {
if
(e.detail.current == 0 && that.data.currentTab > 1) {
that.setData({
currentTab: that.data.currentTab
})
}
else
if
(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年就开始有人提,到现在还在优化,也是够可以的
官方大佬,卡死是个很严重的问题啊