All Products
Search
Document Center

Mobile Platform as a Service:my.offPageNotFound

Last Updated:Jan 12, 2024

Description

my.offPageNotFound

Remove the listener function for the event that the page to be opened by the mini program does not exist.

Input parameter

Function listener

The listener function for the event that the page to be opened by the mini program does not exist.

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() {
 
 }
})