From f3471b2646c29480aef24e9632d15a6c048bd57e Mon Sep 17 00:00:00 2001 From: aisen Date: Tue, 26 Nov 2024 15:34:11 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=9B=BE=E7=89=87=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=8B=96=E6=8B=BD=E6=8E=92=E5=BA=8F=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?h5=E4=B8=8B=E4=BF=9D=E6=8C=81=E5=92=8C=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E4=B8=80=E8=87=B4=E4=BD=93=E9=AA=8C=EF=BC=8C=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E9=95=BF=E6=8C=89=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tn-image-upload-drag.vue | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/tuniao-ui/components/tn-image-upload-drag/tn-image-upload-drag.vue b/tuniao-ui/components/tn-image-upload-drag/tn-image-upload-drag.vue index dde0d35..687abb4 100644 --- a/tuniao-ui/components/tn-image-upload-drag/tn-image-upload-drag.vue +++ b/tuniao-ui/components/tn-image-upload-drag/tn-image-upload-drag.vue @@ -300,7 +300,9 @@ }, timer: null, dragging: false, - show:true + show:true, + h5LongPress:false, + h5StarDragging:false } }, watch: { @@ -329,7 +331,10 @@ mounted() { this.$nextTick(() => { this.updateDragInfo() - }) + }); + // #ifdef H5 + this.h5LongPress = true; + // #endif }, methods: { // 清除列表 @@ -737,7 +742,12 @@ } // #endif }, - movableLongPress(item) { + movableLongPress(item,e) { + // #ifdef H5 + //h5必须长按后才允许拖拽 + this.h5StarDragging = true; + this.movableStart(item); + // #endif // #ifndef H5 uni.vibrateShort() // console.log("LongPress--------------------------------------------------------------"); @@ -804,7 +814,10 @@ } }, movableStart (item) { - // console.log("movableStart"); + if (this.h5LongPress && !this.h5StarDragging){ + return + } + //console.log("movableStart"); this.lists.forEach(item => { item.zIndex = 1 // #ifdef H5 @@ -825,8 +838,9 @@ // #endif }, movableEnd (item) { + this.h5StarDragging = false; if (!this.dragging) return - // console.log("movableEnd"); + //console.log("movableEnd"); const index = this.lists.findIndex(obj => { return obj.id === item.id }) @@ -892,6 +906,9 @@ .tn-image-upload { position: relative; + /* #ifdef H5 */ + -webkit-touch-callout:none; + /* #endif */ &__movable-area { width: 100%;