onBackPress(e) {
//e.from === 'backbutton' 说明如果点击的是物理返回键或导航栏的返回键就进行以下操作
if (e.from === 'backbutton') {
// 退出当前应用,改方法只在App中生效
switch (uni.getSystemInfoSync().platform) {
case 'android':
plus.runtime.quit();
break;
case 'ios':
plus.ios.import('UIApplication').sharedApplication().performSelector('exit');
break;
}}
},
Android 实体返回键 (from = backbutton)
顶部导航栏左边的返回按钮 (from = backbutton)
返回 API,即 uni.navigateBack() (from = navigateBack)