javascript
export default {
onReady() {
if (typeof plus !== 'undefined') {
plus.screen.lockOrientation('landscape-primary'); // 锁定横屏
}
},
onDestroyed() {
plus.screen.unlockOrientation(); // 离开页面时解锁方向
}
}
-
plus.screen.lockOrientation
支持参数:landscape-primary
(正横屏)、landscape-secondary
(反横屏)。
-
需在
onDestroyed
或onUnload
中解锁,避免影响其他页面