ionic-framework - 卡片上的离子长按事件
问题描述
如何在 Ionic 中为卡片设置长按事件以启动特定卡片的操作表。帮我把这个长按事件绑定到 ionic
解决方案
Ionic 4 手势:安装 HammerJs。
npm install hammerjs
里面: src/main.ts
/**
* Hammerjs must be imported for gestures
*/
import 'hammerjs';
您可以执行以下操作:
<ion-card (press)="tapEvent($event)">
<ion-item>
Tapped: {{tap}} times
</ion-item>
</ion-card>
在 .ts
tapEvent(e){
console.log(e);
this.tap++;
}
推荐阅读
- javascript - 如何将返回值保存到变量中
- node.js - 发布生产失败:等待条件超时(无文件上传)
- java - 我们可以在Android中加载相对于其链接的任何网页吗
- php - 无法简单登录 PHP Form Centos 8 Nginx 1.41
- python - ValueError:检查目标时出错:预期dense_33的形状为(60、60、5)但得到的数组形状为(240、240、5)
- spring - 如何在 Spring RestController 方法中从请求中提取查询参数?
- vhdl - Vhdl:不受约束的数组和大小实例化
- javascript - 如果许多功能依赖于响应,那么等待 jquery ajax getJSON 完成的最佳方法是什么?
- playframework - 在 Play2 中配置 akka-http 请求超时
- c++ - 如何使用 resetiosflags 重置 ostream 标志?