uniapp隐藏状态栏并强制横屏
1.manifest.json中:
"screenOrientation": [
"landscape-primary", //可选,字符串类型,支持横屏
"landscape-secondary" //可选,字符串类型,支持反向横屏
]
2.App.vue:
<script>
export default {
onLaunch: function() {
// #ifdef APP-PLUS
// 隐藏手机系统状态栏
plus.navigator.setFullscreen(true);
plus.screen.lockOrientation('landscape-primary'); // 强制横屏
// #endif
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
}
</script>
这样设置后打包后也是强制横屏的。