From b0f2698a1e2013ef1d2f6e065094c2f650e7ff79 Mon Sep 17 00:00:00 2001 From: shutao Date: Thu, 17 Oct 2024 11:47:58 +0800 Subject: [PATCH] =?UTF-8?q?update=20swiper.uvue=20=E9=80=82=E9=85=8Dkotlin?= =?UTF-8?q?=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/swiper/swiper.uvue | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/component/swiper/swiper.uvue b/pages/component/swiper/swiper.uvue index 35bafccd..29154d00 100644 --- a/pages/component/swiper/swiper.uvue +++ b/pages/component/swiper/swiper.uvue @@ -130,9 +130,11 @@ 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 + let eleRect = ele?.getBoundingClientRect() + if(eleRect != null) { + this.swipeX = eleRect.width - 10 + this.swipeY += eleRect.y + uni.getSystemInfoSync().safeArea.top + 44 + 35 + } }, methods: { swipertouchStart(e: UniTouchEvent) { -- GitLab