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

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

上级 eb0e98b0
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<view> <view>
<page-head title="swiper,可滑动视图"></page-head> <page-head title="swiper,可滑动视图"></page-head>
<view class="uni-margin-wrap"> <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" :rebound="reboundSelect" :interval="intervalSelect" :circular="circularSelect"
:indicator-color="indicatorColor" :indicator-active-color="indicatorColorActive" :indicator-color="indicatorColor" :indicator-active-color="indicatorColorActive"
:disable-touch="disableTouchSelect" :current="currentVal" :current-item-id="currentItemIdVal" :disable-touch="disableTouchSelect" :current="currentVal" :current-item-id="currentItemIdVal"
...@@ -122,8 +122,17 @@ ...@@ -122,8 +122,17 @@
animationfinishDetailTest: null as UniSwiperAnimationFinishEventDetail | null, animationfinishDetailTest: null as UniSwiperAnimationFinishEventDetail | null,
isChangeTest: '', isChangeTest: '',
isTransitionTest: '', 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: { methods: {
swipertouchStart(e: UniTouchEvent) { swipertouchStart(e: UniTouchEvent) {
......
...@@ -19,9 +19,12 @@ describe('swiper-touch-test', () => { ...@@ -19,9 +19,12 @@ describe('swiper-touch-test', () => {
it('swiper-touch-test', async () => { it('swiper-touch-test', async () => {
let x = await page.data('swipeX')
let y = await page.data('swipeY')
await program.swipe({ await program.swipe({
startPoint: {x: 246,y: 193}, startPoint: {x: x,y: y},
endPoint: {x: 1,y: 193}, endPoint: {x: 10,y: y},
duration: 200 duration: 200
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册