- 滑动过快小概率会闪屏(animate.transform切换时带来的闪动,可能item渲染内容过多闪动更明显)
- 目前功能较单一,欢迎issue
请直接用小程序开发工具导入预览
复制 components/*
到你的components/slide-page/
目录
pages/index.json
"components": {
"slide-page": "components/slide-page/index"
}
pages/index.js
Page({
data: {
slideData: [{...}, ...]
},
/**
* @param {object} e.detail - { activeIndex, previoursIndex, viewData }
*/
onSlideChangeStart(e) {},
onSlideChangeEnd(e) {},
onSlideTransitionStart(e) {},
onSlideTransitionEnd(e) {}
})
pages/index.wxml
<slide-page
data="{{ slideData }}"
bind:changeStart="onSlideChangeStart"
bind:changeEnd="onSlideChangeEnd"
bind:transitionStart="onSlideTransitionStart"
bind:transitionEnd="onSlideTransitionEnd"
/>
components/slide-page/item/*
这是你自己改写的部分
处理 slide-item 的渲染与逻辑