Compare commits

...

3 Commits

@@ -300,7 +300,9 @@
}, },
timer: null, timer: null,
dragging: false, dragging: false,
show:true show:true,
h5LongPress:false,
h5StarDragging:false
} }
}, },
watch: { watch: {
@@ -329,7 +331,11 @@
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.updateDragInfo() this.updateDragInfo()
}) });
// #ifdef H5
const userAgent = navigator.userAgent.toLowerCase();
this.h5LongPress = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(userAgent);
// #endif
}, },
methods: { methods: {
// 清除列表 // 清除列表
@@ -738,6 +744,11 @@
// #endif // #endif
}, },
movableLongPress(item) { movableLongPress(item) {
// #ifdef H5
//h5必须长按后才允许拖拽
this.h5StarDragging = true;
this.movableStart(item);
// #endif
// #ifndef H5 // #ifndef H5
uni.vibrateShort() uni.vibrateShort()
// console.log("LongPress--------------------------------------------------------------"); // console.log("LongPress--------------------------------------------------------------");
@@ -804,6 +815,9 @@
} }
}, },
movableStart (item) { movableStart (item) {
if (this.h5LongPress && !this.h5StarDragging){
return
}
//console.log("movableStart"); //console.log("movableStart");
this.lists.forEach(item => { this.lists.forEach(item => {
item.zIndex = 1 item.zIndex = 1
@@ -825,6 +839,7 @@
// #endif // #endif
}, },
movableEnd (item) { movableEnd (item) {
this.h5StarDragging = false;
if (!this.dragging) return if (!this.dragging) return
//console.log("movableEnd"); //console.log("movableEnd");
const index = this.lists.findIndex(obj => { const index = this.lists.findIndex(obj => {
@@ -892,6 +907,9 @@
.tn-image-upload { .tn-image-upload {
position: relative; position: relative;
/* #ifdef H5 */
-webkit-touch-callout:none;
/* #endif */
&__movable-area { &__movable-area {
width: 100%; width: 100%;