Description
my.offPageNotFound
Removes a listener function for the page-not-found event in a Mini Program.
Input parameter
Function listener
The listener function for the page-not-found event to remove.
Sample code
my.offPageNotFound(Function listener)
//app.js
const handlePageNotFound = (res) => {
my.redirectTo({
url: 'pages/...'
}); // For a tabbar page, use my.switchTab.
};
my.onPageNotFound(handlePageNotFound)
// Call the API at an appropriate time and remove the listener function.
my.offPageNotFound(handlePageNotFound)
App({
onLaunch() {
}
})