Ionic3学习笔记(三)禁止横屏

来源:互联网 发布:zoom会议软件注册 编辑:程序博客网 时间:2024/06/05 23:55

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

目录

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

1. 安装

命令行输入

ionic cordova plugin add cordova-plugin-screen-orientationnpm 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                     =>      所有都允许

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