我正在使用这些配置的应用程序:

项目清单”

  • Cordova(Cordova CLI):8.0.0

  • @ ionic / app-scripts:3.1.9 -Cordova平台:android 6.2.3 -Ionic Framework:ionic-angular 3.9.2

我使用“cordova插件屏幕方向”将屏幕从纵向旋转到横向,反之亦然 . 我面临的问题是,每当我在特定页面上增加特定div的高度时,我就会将屏幕从横向旋转到纵向(不是所有设备特定的)

我使用的代码是:

orientation.onChange().subscribe((data) => {
        let type = orientation.type;
        console.log('orientation type--', type);
        if (this.platform.is('android')) {
          if(type.includes('landscape')){
            this.isScreenOrientationLandscape = true;
            this.presentChangeOrientationModal();

          }else{
            if(this.changeOrientationModal !== null && this.changeOrientationModal !== undefined){
              this.changeOrientationModal.dismiss();
            }
            this.isScreenOrientationLandscape = false;
          }
        } else if (this.platform.is('ios')) {
          if(type.includes('portrait')){
            this.isScreenOrientationLandscape = true;
            this.presentChangeOrientationModal();
          }else{
            if(this.changeOrientationModal !== null && this.changeOrientationModal !== undefined){
              this.changeOrientationModal.dismiss();
            }
            this.isScreenOrientationLandscape = false;
          }
        }
      });

我尝试了一些修复但无法解决此问题的实际原因 .