cordova-plugin-screen-orientation

ionic cordova plugin add cordova-plugin-screen-orientation  

添加配置 - config.xml

<preference name="orientation" value="portrait" />  

动态修改锁定方向

$scope.$on('$ionicView.beforeEnter', function() {
  if (typeof screen.orientation != 'undefined') {
    screen.orientation.unlock();
  }
});
$scope.$on('$ionicView.afterLeave', function() {
  if (typeof screen.orientation != 'undefined') {
    screen.orientation.lock('portrait');
  }
});

相关文章:

  • 2021-06-23
  • 2022-02-20
  • 2022-12-23
  • 2021-12-02
  • 2021-05-17
猜你喜欢
  • 2021-06-10
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2021-07-13
  • 2021-12-18
相关资源
相似解决方案