ElemeFE / mint-ui

Mobile UI elements for Vue.js
http://mint-ui.github.io/#!/en
MIT License
16.55k stars 3.55k forks source link

[Bug Report] 在使用picker组件中,滑动选项会造成整个页面一起滑动 #891

Open crastyle opened 7 years ago

crastyle commented 7 years ago

Mint UI version

2.2.7

OS/Browsers version

ios 10.3

Vue version

2.2.2

Reproduction Link

https://jsfiddle.net/pj71jkyw/222/

Steps to reproduce

在选择日期的时候,拖动年月份选项会出现整屏滑动。可以使用手机打开此链接进行查看:http://czgy.mbjyy.net/front/patient/#/login

What is Expected?

背景应该被锁定,只是组件滑动

What is actually happening?

在使用picker组件中,滑动选项会造成整个页面一起滑动。我查看了很多相关的issue都提到了这个问题,但是却没有被实际解决。加了preventDefault也是无效的。 可以使用手机打开此链接进行查看:http://czgy.mbjyy.net/front/patient/#/login

QiiSyhx commented 7 years ago

没人维护这个项目了吗?都过29天了,也没有解决

617450941 commented 7 years ago

我也发现这问题了 这问题很严重啊 项目用了大半才发现这问题的坑 mint ui难道已经没人维护了

Lunber commented 7 years ago

遇到了相同的问题 现在有一个比较hack的方法

openHandler: function () {
      window.addEventListener('touchmove', this.moveHandler, false);
      window.addEventListener('touch', this.touchHandler, false);
      window.addEventListener('click', this.touchHandler, false);
      this.$refs.picker.open();
    },
    moveHandler: function () {
      event.preventDefault();
      event.stopPropagation();
    },
    touchHandler: function () {
      if (event.target.className.includes('mint-datetime-cancel') || event.target.className.includes('v-modal')) {
        window.removeEventListener('touchmove', this.moveHandler, false);
        window.removeEventListener('touch', this.touchHandler, false);
        window.removeEventListener('click', this.touchHandler, false);
      }
    },

在打开的时候屏蔽整个页面的滑动事件,并且监听关闭(并没有提供官方的关闭回调,所以监听可以关闭的元素的click和touch事件)。 mint-ui并没有使用tochmove,所以不会影响,希望有所帮助。

yoyo0926 commented 6 years ago

我也遇到这个问题了,不过我把这个组件摘出去了,不和滑动在一块

yuxizhe commented 6 years ago

ios 11 没遇到这个问题

Mark24Code commented 6 years ago

同样遇到这个问题,期待解决

CodeDreamfy commented 6 years ago

我在滑动的时候给body添加了阻止滑动的事件,然后滑动结束删除事件

Eamonnzhang commented 6 years ago

外面再套一层div,加上touchmove.prevent <div @touchmove.prevent> <mt-datetime-picker v-model="pickerValue" type="date" ref="picker" @confirm="handleConfirm" :start-date="startDate" :end-date="endDate" year-format="{value}" month-format="{value}" date-format="{value}"> </mt-datetime-picker> </div>

RicoLiu commented 6 years ago

我也遇到了同样问题

617450941 commented 6 years ago

放弃吧 这开源项目已经没有活力了 弃坑