app锁定横竖屏:
onLaunch: function () {
// app 锁定横屏
// plus.screen.lockOrientation("landscape-primary");
// app 锁定竖屏
plus.screen.lockOrientation("portrait-primary");
},
js样式控制,官方文档里有:
onShow() {
uni.onWindowResize((res) => {
if (res.size.windowWidth > res.size.windowHeight) {
alert('此时为横屏')
}
})
}
css样式控制:
/* 竖屏 */
@media screen and (orientation: portrait) {}
/* 横屏 */
@media screen and (orientation: landscape) {}