该代码如下所示:
(char)(arr[i] + 2)
组件代码
<div (swipeleft)="swipe(idx, $event.type)" (swiperight)="swipe(idx, $event.type)">
<md-tab-group md-stretch-tabs [(selectedIndex)]="selectedIndex" (selectedIndexChange)="selectChange()">
<md-tab label={{category}} *ngFor="let category of itemCategory">
</md-tab>
</md-tab-group>
</div>
我使用的材料版本是export class InfoComponent {
selectedIndex: number = 1;
selectChange(): void{
console.log("Selected INDEX: " + this.selectedIndex);
}
SWIPE_ACTION = { LEFT: 'swipeleft', RIGHT: 'swiperight' };
// Action triggered when user swipes
swipe(selectedIndex: number, action = this.SWIPE_ACTION.RIGHT) {
// Out of range
if (this.selectedIndex < 0 || this.selectedIndex > 1 ) return;
// Swipe left, next tab
if (action === this.SWIPE_ACTION.LEFT) {
const isLast = this.selectedIndex === 1;
this.selectedIndex = isLast ? 0 : this.selectedIndex + 1;
console.log("Swipe right - INDEX: " + this.selectedIndex);
}
// Swipe right, previous tab
if (action === this.SWIPE_ACTION.RIGHT) {
const isFirst = this.selectedIndex === 0;
this.selectedIndex = isFirst ? 1 : this.selectedIndex - 1;
console.log("Swipe left - INDEX: " + this.selectedIndex);
}
}
}
。我在这里遗漏了什么,因为刷卡功能不起作用?