tencent cloud

Feedback

Redirect

Last updated: 2024-11-21 18:41:53

    exitMiniProgram

    The method of utilizing this API is wx.exitMiniProgram(Object object).
    Function Description: This function facilitates the termination of the current mini program. A successful invocation necessitates a click action.
    Parameters and Description: Object object.
    Attributes
    Types
    Default value
    Required
    Note
    success
    function
    -
    Not required
    Successful Interface Call Callback Function
    fail
    function
    -
    Not required
    Callback function for unsuccessful interface invocation
    complete
    function
    -
    Not required
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

    navigateToMiniProgram

    The method for utilizing this API is wx.navigateToMiniProgram(Object object)
    Function Description: Launches another mini program.
    Parameters and Description: Object object.
    Attributes
    Types
    Default value
    Required
    Note
    appId
    string
    -
    Supported
    The appId of the mini program to be launched
    path
    string
    -
    Not required
    The path of the page to be opened, if it is empty then the first page will be opened, the part of path after ? The part after the path will become query, you can get the query data in the callback function of App.onLaunch, App.onShow and Page.onLoad of the mini program or wx.getLaunchOptionsSync.
    extraData
    object
    -
    Not required
    Data to be passed to the target mini program; the target mini program can retrieve this data in App.onLaunch, App.onShow
    envVersion
    string
    release
    Not required
    The version of the mini program to be launched. This parameter is only effective when the current mini program is in development or trial version. If the current mini program is in the official version, the mini program to be launched will definitely be the official version. The valid values are as follows:
    develop: Development Version
    trial: Trial Version
    release: Official Version
    success
    function
    -
    Not required
    Callback function for successful interface invocation
    fail
    function
    -
    Not required
    Callback function for unsuccessful interface invocation
    complete
    function
    -
    Not required
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

    Usage Limits

    Requires user-initiated redirection

    If the user does not click on any location within the mini-program page, the developer will be unable to invoke this interface to automatically redirect to another mini-program.

    User confirmation required for redirection

    Before redirecting to another mini-program, a unified pop-up window will be added, asking whether to redirect. The user can only redirect to another mini-program after confirmation. If the user clicks on cancel, the callback fail cancel will be triggered.

    Each mini-program is limited to redirecting to no more than 10 other mini-programs.

    When developers submit a new version of the mini-program code, if the function to redirect to other mini-programs is used, it is necessary to declare in the code configuration the list of mini-programs to which it will redirect, limited to no more than 10, otherwise it will not pass the review. This list can be updated when a new version is released and does not support dynamic modification. For configuration methods, see Configuration. When invoking this interface, the appId to which it redirects must be in the configuration list, otherwise the callback fail appId "${appId}" is not in navigateToMiniProgramAppIdList will be triggered.
    Sample Code:
    wx.navigateToMiniProgram({
    appId: '',
    path: 'page/index/index?id=123',
    extraData: {
    foo: 'bar'
    },
    envVersion: 'develop',
    success(res) {
    // Successfully opened
    }
    })

    navigateBackMiniProgram

    The usage method for this API is wx.navigateBackMiniProgram(Object object).
    Function Description: Returns to the previous mini-program. This function can only be successfully invoked when the current mini-program is opened by another mini-program.
    Parameters and Description: Object object
    Attributes
    Types
    Default value
    Required
    Note
    extraData
    Object
    {}
    Not required
    Data that needs to be returned to the previous mini-program can be obtained in the App.onShow of the previous mini-program.
    success
    function
    -
    Not required
    Callback function for successful interface invocation
    fail
    function
    -
    Not required
    Callback function for unsuccessful interface invocation
    complete
    function
    -
    Not required
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Example Code
    wx.navigateBackMiniProgram({
    extraData: {
    foo: 'bar'
    },
    success(res) {
    // Successful return
    }
    })
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support