Dart Cordova+聚合物+Angular2+FastClick

Alo*_*mir 5 dart cordova dart-polymer fastclick.js angular

将 Dart Polymer 的纸元素与 Angular 2 一起使用时,如何消除 iOS 设备上约 300 毫秒的点击延迟?

例如,在一个 Angular 2 组件中,如果我有一个包含paper-buttonwith的 HTML 模板(click)="myFunc()",在 iOS 设备中,myFunc 在这个可怕的臭名昭著的延迟之后被调用。

我试过使用 FastClick.js,但是在我将它附加(到身体,或特定的纸按钮)之后,该元素不再可点击,当我点击它时我仍然可以看到涟漪效果,但方法是没有被调用(在移动设备上,但在桌面浏览器中它照常工作),它对paper-input(s)也有相同的影响,它没有得到关注。

可以做些什么吗?也许可以制作一个相当于 FastClick.js 的 Dart/Angular2?

更新 1

值得一提的是,在一个UIWebView(cordova)下,我无法让Angular2.dart和Polymer.dart同时工作,看起来它们不能很好地协同工作,这也是一个障碍,可以使用一些帮助也是如此。

更新 2

来源:https : //github.com/aabluedragon/dart_issue_polymer_angular2_cordova

更新 3

  • 白屏问题:在Cordova下首次运行出现白屏问题,看来与Polymer有关;它与 Angular2 无关。
  • 点击延迟:使用 Polymer 的on-tap事件可以防止点击延迟,但是,这意味着您不能使用 Angular2 的(点击)事件,它不能像 Polymer 那样很好地处理点击。

Yes*_*rry 2

我无法让 FastClick 与 Angular 2+(在我的例子中是 Angular 4)一起使用,但我找到了一种名为ng2-events的不同解决方案,它具有多种功能,其中之一是支持 Angular 4 中的触摸事件

# for angular 5
npm install --save ng2-events
# for angular 4
npm install --save ng2-events@3.1.0
Run Code Online (Sandbox Code Playgroud)

然后在app.module.ts中

import {NgModule} from "@angular/core";
import {TouchEventModule} from "ng2-events/lib/touch";

@NgModule({
    imports: [TouchEventModule],
    exports: [TouchEventModule]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)

然后在你的模板中:

<button (down)="touchAction()">Try this on mobile device</button>
Run Code Online (Sandbox Code Playgroud)