ionic4 手勢事件:左滑、右滑

1、安裝插件

npm install hammerjs --save/cnpm install hammerjs --save

2、ts界面引入命令

import "hammerjs";

3、ts界面寫測試方法

//左滑事件
  async test() {
    const alert = await this.alertController.create({
      header: '^_^溫馨提示',
      message: "左滑事件",
      buttons: [
        {
          text: '確定',
          handler: () => {
          }
        }
      ]
    });
    await alert.present();
  }

4、html頁標籤手勢事件調用ts方法

<ion-content (swipeleft)="test()" (swiperight)="test1()">
……
</ion-content>

效果演示(僅供演示,忽略背景)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章