uniapp 设置某个页面横屏退出时取消横屏

1.manifest.json文件设置

"orientation" : [
                "portrait-primary",
                "portrait-secondary",
                "landscape-primary",
                "landscape-secondary"
            ],

2.需要横屏的页面设置

setTimeout(function(){
        plus.screen.lockOrientation('landscape-primary');
   },1500)

3.横屏页面来源页面设置取消屏幕锁定,并设置为竖屏

onShow() {
            var that = this;
            // #ifdef APP-PLUS
                plus.screen.unlockOrientation(); //解除屏幕方向的锁定,但是不一定是竖屏;
                plus.screen.lockOrientation('portrait'); //锁死屏幕方向为竖屏
            // #endif
        },

猜你喜欢

转载自blog.csdn.net/qq_35086913/article/details/107555856