mui双击返回

 先禁用当前页面的返回事件

mui.init({
	keyEventBind: {
		backbutton: false  //关闭back按键监听
	}
});

 在index.html里

var backButtonPress = 0;
mui.back = function(event) {
    backButtonPress++;
    
    if (backButtonPress > 1) {
      plus.runtime.quit();
    } else {
      plus.nativeUI.toast('再按一次退出应用');
    }
    setTimeout(function() {
      backButtonPress = 0;
    }, 1000);
    return false;
  };

 

猜你喜欢

转载自blog.csdn.net/supertree_l/article/details/84338796
0条评论
添加一条新回复