uniapp realizes horizontal and vertical screen switching

 When developing the mobile terminal in uniapp, you will encounter business scenarios where the mobile terminal needs to be fixed or switched between horizontal and vertical screens. The following is the code for the mobile terminal in uniapp to achieve fixed vertical screen and fixed horizontal screen: vertical screen code
 :

if (this.$api.os.plus()) {
    
     //app境调用授权
plus.screen.lockOrientation('portrait-primary');
}

 Horizontal screen code:

// #ifdef APP-PLUS
plus.screen.lockOrientation("landscape-primary");
// #endif

Guess you like

Origin blog.csdn.net/weixin_38611617/article/details/128778318