原因是onLaunch锁定横屏的时候有一定延迟,这时候还没完全切换为横屏的时候就已经加载webview,所以webview 是按竖屏的时候加载样式。
onLaunch: function() {
console.log('App Launch');
plus.screen.lockOrientation("landscape-primary"); // 锁定横屏
// 设置全屏
plus.navigator.setFullscreen(true);
// plus.screen.lockOrientation('portrait');
// let sysObj = uni.getSystemInfoSync();
// let windowWidth = sysObj.windowWidth
// let windowHeight = sysObj.windowHeight
// console.log(windowWidth)
// console.log(windowHeight)
// 853 480 转屏后
// 默认(竖屏) 480 853
},
解决方法 setTimeout 延迟300毫秒加载