提交 fc3f623e 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(swiper): 屏蔽小程序不支持方法

上级 54ac0743
...@@ -122,26 +122,28 @@ ...@@ -122,26 +122,28 @@
animationfinishDetailTest: null as UniSwiperAnimationFinishEventDetail | null, animationfinishDetailTest: null as UniSwiperAnimationFinishEventDetail | null,
isChangeTest: '', isChangeTest: '',
isTransitionTest: '', isTransitionTest: '',
isAnimationfinishTest: '', isAnimationfinishTest: '',
swipeX: 0, swipeX: 0,
swipeY: 0 swipeY: 0
} }
}, },
onReady() { onReady() {
// 获取模拟滑动手势的起始点 // #ifndef MP
let ele = uni.getElementById("swiper-view") // 获取模拟滑动手势的起始点
let ele = uni.getElementById("swiper-view")
let eleRect = ele?.getBoundingClientRect() let eleRect = ele?.getBoundingClientRect()
if(eleRect != null) { if(eleRect != null) {
this.swipeX = eleRect.width - 10 this.swipeX = eleRect.width - 10
this.swipeY += eleRect.y + uni.getSystemInfoSync().safeArea.top + 44 + 35 this.swipeY += eleRect.y + uni.getSystemInfoSync().safeArea.top + 44 + 35
} }
// #endif
}, },
methods: { methods: {
swipertouchStart(e: UniTouchEvent) { swipertouchStart(e: UniTouchEvent) {
console.log("swiper touchstart") console.log("swiper touchstart")
}, },
viewtouchStart(e: UniTouchEvent) { viewtouchStart(e: UniTouchEvent) {
console.log("view touchstart:") console.log("view touchstart:")
}, },
swiperChange: function (e : UniSwiperChangeEvent) { swiperChange: function (e : UniSwiperChangeEvent) {
this.changeDetailTest = e.detail this.changeDetailTest = e.detail
...@@ -182,12 +184,12 @@ ...@@ -182,12 +184,12 @@
} }
}, },
// 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取) // 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)
checkEventTest(e : SwiperEventTest, eventName : String) { checkEventTest(e : SwiperEventTest, eventName : String) {
// #ifndef MP // #ifndef MP
const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement; const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;
// #endif // #endif
// #ifdef MP // #ifdef MP
const isPass = true; const isPass = true;
// #endif // #endif
const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`; const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;
switch (eventName) { switch (eventName) {
...@@ -284,4 +286,4 @@ ...@@ -284,4 +286,4 @@
text-align: center; text-align: center;
line-height: 150px; line-height: 150px;
} }
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册