Angular Material 使用 HammerJS 的工具提示错误解决方法

Angular Material tooltip bug workaround with HammerJS

我最近在我的应用程序中发现了一些与 mat-tooltips 的触摸滚动问题相关的错误。此处概述了此行为:GitHub Issue. There is a workaround solution posted in the issue page that seems to have worked in the past. This is no longer is the case. The post has instructions for overriding the HammerJS configuration class. Here is the link to that post from 2017: Tutorial.

现在学习本教程会导致问题:

mc.get("swipe").set({ velocity: 0.3, threshold: 10 }); 抛出错误,因为 get() 似乎不再存在于 HammerManager 上。

是否有其他方法获取并设置 swipe 操作?我似乎找不到太多关于配置它的信息。

hammer.get("swipe") 更改为 hammer.Swipe()

在你的情况下,你甚至不需要传递参数,因为你的参数是默认的。

有关详细信息,请参阅 Docs