gpt4 book ai didi

android - ionic 后退按钮

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:42:57 26 4
gpt4 key购买 nike

我有基本的 Ionic 应用程序,我禁用了应用程序上的后退按钮,是否有原因导致后退按钮在 Android 设备上仍然有效?

我目前正在使用 ionic View 进行测试。

这是我的代码:

.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);
})

最佳答案

根据 ionic 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);

关于android - ionic 后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34731255/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com