如何将手机设置为仅竖屏,同时允许平板在竖屏和横屏之间切换?
我正在使用Ionic / Cordova。
目前,我已经使用以下属性在config.xml中配置了应用程序的竖屏模式:
<preference name="orientation" value="portrait" />
如何将手机设置为仅竖屏,同时允许平板在竖屏和横屏之间切换?
我正在使用Ionic / Cordova。
目前,我已经使用以下属性在config.xml中配置了应用程序的竖屏模式:
<preference name="orientation" value="portrait" />
您可以使用isTablet插件与屏幕方向插件结合使用,如下所示:
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.isTablet){
screen.unlockOrientation();
}else{
screen.lockOrientation('portrait');
}
});
})