美文网首页
苹果浏览器safari出现左右滑动,上一页下一页问题

苹果浏览器safari出现左右滑动,上一页下一页问题

作者: 追风筝的Hassan | 来源:发表于2019-11-05 14:07 被阅读0次

在钉钉上开发CRM使用的是H5微应用,页面之间的跳转采用的是this.$router.push()的方式,最近偶然发现,在苹果浏览器上出现了左右滑动出现上一页下一页的情况,
采用了办法一:

 let self = this
      document.addEventListener('touchstart', function (e) {
        self.moveY = e.targetTouches[0].pageY
      })
      document.addEventListener('touchmove', function (e) {
        e.preventDefault()
        let moveWidth = self.moveY - e.targetTouches[0].pageY
        if (moveWidth !== 0) {
          document.body.scrollTop += moveWidth
        }
      })
      document.addEventListener('touchmove', function (e) {
        e.preventDefault()
      })
  //  禁止右滑

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
// 允许右滑
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }

最终试验结果不起作用,有知道的小伙伴可以分享一下,谢谢。

相关文章

网友评论

      本文标题:苹果浏览器safari出现左右滑动,上一页下一页问题

      本文链接:https://www.haomeiwen.com/subject/zuisbctx.html