本文为原创文章,转载请标明出处

目录

  1. 安装
  2. 使用
  3. 参数

1. 安装

命令行输入

ionic cordova plugin add cordova-plugin-screen-orientation
npm install --save @ionic-native/screen-orientation

./src/app/app.module.ts 中添加

import {ScreenOrientation} from "@ionic-native/screen-orientation";

provides 中添加

ScreenOrientation,

2. 使用

./config.xml 中添加

<preference name="Orientation" value="portrait" />

3. 参数

portrait-primary        =>      不允许副竖屏
portrait-secondary      =>      不允许副竖屏
landscape-primary       =>      不允许副竖屏
landscape-secondary     =>      不允许副竖屏
portrait                =>      允许主竖屏和副竖屏
landscape               =>      允许主横屏和副横屏
any                     =>      所有都允许

如有不当之处,请予指正,谢谢~

相关文章:

  • 2022-12-23
  • 2021-12-02
  • 2021-05-16
  • 2021-05-17
  • 2022-12-23
猜你喜欢
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2021-07-13
  • 2021-06-23
  • 2022-02-20
相关资源
相似解决方案