Ionic framework 爱奥尼亚swing库没有';我不能在手机上工作

Ionic framework 爱奥尼亚swing库没有';我不能在手机上工作,ionic-framework,ionic4,Ionic Framework,Ionic4,我正在使用ionic swing(ionic 4/Angular 7)()来制作类似火绒的卡片,但当我在手机上测试时,它不起作用。它在网络浏览器上运行良好,但对手机上的滑动手势根本没有反应 我认为这是hammer.js的一个问题,但我测试了一个简单的例子,我在滑动手势(“panleft panright”)上显示“left”或“right”,效果很好 在galaxy S8+(Android 9/One UI 1)和oppo F5(我不知道是哪个版本的Android)上测试 视图: <div

我正在使用ionic swing(ionic 4/Angular 7)()来制作类似火绒的卡片,但当我在手机上测试时,它不起作用。它在网络浏览器上运行良好,但对手机上的滑动手势根本没有反应

我认为这是hammer.js的一个问题,但我测试了一个简单的例子,我在滑动手势(“panleft panright”)上显示“left”或“right”,效果很好

在galaxy S8+(Android 9/One UI 1)和oppo F5(我不知道是哪个版本的Android)上测试

视图:

<div class="stack" swingStack #swingStack  [stackConfig]="stackConfig" (throwoutleft)="onThrowOut($event)" (throwoutright)="onThrowOut($event)" (throwout)="onThrowOut($event)">
  <ion-card swingCard #swingCards [ngClass]="c.name" *ngFor="let c of cards">{{ c.symbol }}</ion-card>

{{c.symbol}}

组成部分:

@ViewChild('swingStack', { read: SwingStackDirective }) swingStack: SwingStackDirective;
@ViewChildren('swingCards', { read: SwingCardDirective }) swingCards: QueryList<SwingCardDirective>;

cards: Array<any>;
stackConfig: StackConfig;

constructor() {

this.stackConfig = {
  allowedDirections: [Direction.UP, Direction.DOWN, Direction.LEFT, Direction.RIGHT],
  throwOutConfidence: (offsetX, offsetY, element) => {
    return Math.min(Math.max(Math.abs(offsetX) / (element.offsetWidth / 1.7), Math.abs(offsetY) / (element.offsetHeight / 2)), 1);
  },
  throwOutDistance: (d) => {
    return 800;
  }
}

this.cards = [
  { name: 'clubs', symbol: '♣' },
  { name: 'diamonds', symbol: '♦' },
  { name: 'spades', symbol: '♠' }
];
}

ngAfterViewInit() {
this.swingCards.forEach((c) => console.log(c.getCard()));
this.swingStack.throwoutleft.subscribe(
  (event: ThrowEvent) => console.log('Manual hook: ', event));
this.swingStack.dragstart.subscribe((event: DragEvent) => console.log(event));

this.swingStack.dragmove.subscribe((event: DragEvent) => console.log(event));
}

onThrowOut(event: ThrowEvent) {
console.log('Hook from the template', event.throwDirection);
}
@ViewChild('swingStack',{read:SwingStackDirective})swingStack:SwingStackDirective;
@ViewChildren('swingCards',{read:SwingCardDirective})swingCards:QueryList;
卡片:阵列;
stackConfig:stackConfig;
构造函数(){
this.stackConfig={
allowedDirections:[Direction.UP,Direction.DOWN,Direction.LEFT,Direction.RIGHT],
throwOutConfidence:(offsetX,offsetY,element)=>{
返回Math.min(Math.max(Math.abs(offsetX)/(element.offsetWidth/1.7)、Math.abs(offsetY)/(element.offsetHeight/2)),1);
},
throwOutDistance:(d)=>{
返回800;
}
}
这张卡=[
{名称:'俱乐部',符号:'♣' },
{名称:'钻石',符号:'♦' },
{名称:'黑桃',符号:'♠' }
];
}
ngAfterViewInit(){
this.swingCards.forEach((c)=>console.log(c.getCard());
这是swingStack.throwoutleft.subscribe(
(event:ThrowEvent)=>console.log('Manual hook:',event));
this.swingStack.dragstart.subscribe((事件:DragEvent)=>console.log(事件));
this.swingStack.dragmove.subscribe((事件:DragEvent)=>console.log(事件));
}
onThrowOut(事件:ThrowEvent){
log('Hook from the template',event.throwDirection);
}

您应该说出您遇到问题的手机是android还是ioswith@rtpHarry是的,我编辑过。