uniapp全屏和屏幕方向

如果想要全屏模式,在应用的manifest.json文件中app-plus节点下添加“fullscreen”节点:

Boolea值类型,true表示全屏,false表示非全屏,默认值为false。

fullscreen:true

function fullscreen(){ // 设置应用全屏显示! plus.navigator.setFullscreen(true); } function unfullscreen(){ // 设置应用非全屏显示! plus.navigator.setFullscreen(false); } function isfullscreen(){ // 查询应用当前是否全屏显示! console.log( "是否全屏:"+(plus.navigator.isFullscreen()?"是":"否") ); }
屏幕方向
在应用的manifest.json文件中app-plus节点下添加“screenOrientation”节点:
"screenOrientation" : [ "portrait-primary" ],//竖屏
"screenOrientation" : [ "landscape-primary" ],//横屏
 
 plus.screen.unlockOrientation(); //解除锁定屏幕方向  
 plus.screen.lockOrientation('portrait-primary');//竖屏
plus.screen.lockOrientation("landscape-primary")//横屏

posted on 2021-12-28 08:47  Just丶随心  阅读(3526)  评论(0编辑  收藏  举报

导航