After the WEEX single-page application is embedded in the APP, you can click the physical Back button to exit the WEEX application, instead of returning to the previous WEEX page.
Put this code in the entry js file of the project, using the weeX built-in component globalEvent
var globalEvent = weex.requireModule('globalEvent');
globalEvent.addEventListener('androidback'.function(e) { // AndroidBack is a method written by Android or ios
// Here you can do return events, such as go back to the previous page or exit the application
if (that.$router.currentRoute.name == 'Home') { // WeeX project homepage
weex.requireModule('close').closeApp() // Jump to native page
} else {
that.$router.go(- 1); }})Copy the code