如何在ionic4中使用ios快捷方式?

时间:2019-06-04 13:11:23

标签: angular cordova ionic-framework cordova-plugins ionic4

我有两个文件:

app.component.ts:

this.threeDeeTouch.isAvailable().then(() => {
  const actions: ThreeDeeTouchQuickAction[] = [
    {
      type: 'someButton1',
      title: Hello threre,
      iconType: 'play'
    },
    {
      type: 'someButton2',
      title: General Kenobi,
      iconType: 'compose'
    }
  ];
  this.threeDeeTouch.configureQuickActions(actions);
});

somepage.page.ts:

  ngOnInit() {
    this.threeDeeTouch.isAvailable().then(() => {
      this.threeDeeTouch.onHomeIconPressed().subscribe(
        (payload) => {
          switch (payload.type) {
            case 'someButton1':
              this.myFunction();
              break;
            case 'someButton2':
              this.anotherFunction();
              break;
          }
        }
      );
    });
  }

按钮在我的测试设备上可见并且可以单击,但是单击后,应用程序仅在不调用函数的情况下启动。有人可以解决这个问题吗?

感谢您的帮助:)

0 个答案:

没有答案