Ionic组件之Gestures
Ionic组件之Gestures,支持绑定 tap
, press
, pan
, swipe
, rotate
, and pinch
事件.
效果图:
直接上代码:
gestures.ts
import { Component } from '@angular/core';
@Component({
templateUrl:'gestures.html'
})
export class Gestures{
public press:number=0;
public pan:number=0;
public swipe:number=0;
public tap:number=0;
constructor(){}
pressEvent(e){
this.press++;
}
panEvent(e){
this.pan++;
}
swipeEvent(e){
this.swipe++;
}
tapEvent(e){
this.tap++;
}
}
gestures.html
<ion-header>
<ion-navbar>
<ion-title>Events</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-card (tap)="tapEvent($event)">
<ion-item>Tapped:{{tap}}times</ion-item>
</ion-card>
<ion-card (press)="pressEvent($event)">
<ion-item>Tapped:{{press}}times</ion-item>
</ion-card>
<ion-card (pan)="panEvent($event)">
<ion-item>Tapped:{{pan}}times</ion-item>
</ion-card>
<ion-card (pan)="swipeEvent($event)">
<ion-item>Tapped:{{swipe}}times</ion-item>
</ion-card>
</ion-content>
上一篇:Ionic组件之FABs
下一篇:Ionic组件之Grid
文章
总共 0 条评论