android – 离子后退按钮

前端之家收集整理的这篇文章主要介绍了android – 离子后退按钮前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有基本的离子应用程序,我已经禁用了应用程序上的后退按钮,是否有一个原因,后退按钮仍然在 Android设备上工作?

我目前正在测试离子视图.

这是我的代码

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
  $ionicPlatform.registerBackButtonAction(function(e) {
  e.preventDefault();
  },101);
})

解决方法

根据离子 documentation

Your back button action will override each of the above actions
whose priority is less than the priority you provide.

并且鉴于您希望在所有情况下完全禁用后退按钮,并且引用列表中的操作的最高优先级为500,您应该提供超过500,600的优先级值.放置在$ionicPlatform.ready()中时,下面的代码应该可以工作

$ionicPlatform.registerBackButtonAction(function(e) {},600);
原文链接:https://www.f2er.com/android/310480.html

猜你在找的Android相关文章