1.在子页面添加
<script type="text/javascript">
mui.init({
//监听Android手机的back、menu按键
keyEventBind: {
backbutton: false, //Boolean(默认true)关闭back按键监听
menubutton: true //Boolean(默认true)关闭menu按键监听
},
})
//备份mui.back,mui.back已将窗口关闭逻辑封装的比较完善(预加载及父子窗口),因此最好复用mui.back
var old_back = mui.back;
mui.back = function() {
var btn = ["确定", "取消"];
mui.confirm('确认关闭当前窗口?', 'Hello MUI', btn, function(e) {
if(e.index == 0) {
//执行mui封装好的窗口关闭逻辑;
old_back();
}
});
}
</script>