提交 fe408c9a 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

优化 swiper2.test.js 测试例,动态获取模拟手势坐标点

(cherry picked from commit eb3e2f38)
上级 09087e31
......@@ -5,7 +5,7 @@
<view>
<page-head title="swiper,可滑动视图"></page-head>
<view class="uni-margin-wrap">
<swiper class="swiper" :vertical="verticalSelect" :indicator-dots="dotsSelect" :autoplay="autoplaySelect"
<swiper id="swiper-view" class="swiper" :vertical="verticalSelect" :indicator-dots="dotsSelect" :autoplay="autoplaySelect"
:rebound="reboundSelect" :interval="intervalSelect" :circular="circularSelect"
:indicator-color="indicatorColor" :indicator-active-color="indicatorColorActive"
:disable-touch="disableTouchSelect" :current="currentVal" :current-item-id="currentItemIdVal"
......@@ -122,8 +122,17 @@
animationfinishDetailTest: null as UniSwiperAnimationFinishEventDetail | null,
isChangeTest: '',
isTransitionTest: '',
isAnimationfinishTest: ''
isAnimationfinishTest: '',
swipeX: 0,
swipeY: 0
}
},
onReady() {
// 获取模拟滑动手势的起始点
let ele = uni.getElementById("swiper-view")
let eleRect = ele?.getBoundingClientRect()
this.swipeX = eleRect!.width - 10
this.swipeY += eleRect!.y + uni.getSystemInfoSync().safeArea.top + 44 + 35
},
methods: {
swipertouchStart(e: UniTouchEvent) {
......
......@@ -19,9 +19,12 @@ describe('swiper-touch-test', () => {
it('swiper-touch-test', async () => {
let x = await page.data('swipeX')
let y = await page.data('swipeY')
await program.swipe({
startPoint: {x: 246,y: 193},
endPoint: {x: 1,y: 193},
startPoint: {x: x,y: y},
endPoint: {x: 10,y: y},
duration: 200
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册