小编Car*_*uez的帖子

Ionic 5 电容器硬件后退按钮结束应用程序

我在手机和 android studio 上测试我的离子应用程序时遇到问题,当我按下硬件后退按钮时,应用程序立即退出,我尝试了很多解决方案,但它根本不起作用,也不会听我的任何代码进去。

这是我的尝试

import { Component, Renderer2, ViewChild } from '@angular/core';

import { IonRouterOutlet, Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { TranslateService } from '@ngx-translate/core';
import { Location } from '@angular/common';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss']
})
export class AppComponent {

  @ViewChild(IonRouterOutlet, {static: true}) routerOutlet: IonRouterOutlet
  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private renderer: Renderer2,
    private translate: TranslateService,
    private location: Location …
Run Code Online (Sandbox Code Playgroud)

android ionic-framework angular capacitor ionic5

1
推荐指数
1
解决办法
2616
查看次数

标签 统计

android ×1

angular ×1

capacitor ×1

ionic-framework ×1

ionic5 ×1