gpt4 book ai didi

html - (swipeup) 不会在 Angular 4 中使用 Hammerjs 触发

转载 作者:太空狗 更新时间:2023-10-29 18:05:13 27 4
gpt4 key购买 nike

我注意到指令 (swipeup) 似乎不起作用:我试过使用 (swipeleft) 并且有效:

<div [@myAnimation] (swipeup)="showActionBar = false" fxFlex="56px" *ngIf="showActionBar" fxLayoutWrap fxLayoutAlign="start center"fxLayoutGap="8px" class="overview-actions">

有没有人对此有解决方案/解决方法。我已经看过但没有找到与我的问题相关的解决方案。

谢谢,J.

最佳答案

您可以从@angular/platform-b​​rowser 导入锤子配置并覆盖它。默认情况下,向上和向下滑动是关闭的,因为它们可能会在用户尝试滚动时给他们带来问题。

app.module.ts

  import * as Hammer from 'hammerjs';
import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';

export class HammerConfig extends HammerGestureConfig {
overrides = <any>{
'swipe': { direction: Hammer.DIRECTION_ALL }
};
}

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [
{
provide: HAMMER_GESTURE_CONFIG,
useClass: HammerConfig
}
],
bootstrap: [AppComponent]
})
export class AppModule { }

关于html - (swipeup) 不会在 Angular 4 中使用 Hammerjs 触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46220102/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com