tencent cloud

Feedback

Interaction

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

    hideLoading

    This API is used via wx.hideLoading(Object object).
    Feature Description: Hides the loading prompt box.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    noConflict
    boolean
    false
    No
    Currently, toast and loading related interfaces can be confused with each other, this parameter can be used to disable the confusion feature.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

    hideToast

    This API is used via wx.hideToast(Object object).
    Feature Description: Hides the message prompt box.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    noConflict
    boolean
    false
    No
    Currently, toast and loading related interfaces can be confused with each other, this parameter can be used to disable the confusion feature.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

    showActionSheet

    This API is used via wx.showActionSheet(Object object).
    Note:
    For Android versions earlier than V6.7.2, upon clicking cancel or the mask layer, the callback fails, with errMsg being "fail cancel".
    For Android versions 6.7.2 and later, as well as iOS, clicking on the mask layer will not close the modal popup. Therefore, it is advisable to avoid implementing business logic within the 'cancel' branch.
    Feature Description: Displays the action menu.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    itemList
    array.<string>
    -
    Yes
    The array of button texts, with a maximum length of 6.
    itemColor
    string
    #000000
    No
    The color of the button text.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Parameters for object.success callback function: Object res.
    Attribute
    Type
    Description
    tapIndex
    number
    The button number clicked by the user, in descending order, starting from 0.
    Sample Code
    wx.showActionSheet({
    itemList: ['A', 'B', 'C'],
    success (res) {
    console.log(res.tapIndex)
    },
    fail (res) {
    console.log(res.errMsg)
    }
    })

    showLoading

    This API is used via wx.showLoading(Object object).
    Feature Description: Displays a loading prompt box. It requires an active call to wx.hideLoading to close the prompt box.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    title
    string
    -
    Yes
    The content of the prompt.
    mask
    boolean
    false
    No
    Whether to display a transparent mask layer to prevent touch penetration.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Sample Code
    wx.showLoading({
    title: 'Loading',
    })
    
    setTimeout(function () {
    wx.hideLoading()
    }, 2000)
    Note:
    Only one of wx.showLoading and wx.showToast can be displayed at a time.
    wx.showLoading should be used in conjunction with wx.hideLoading.

    showModal

    This API is used via wx.showModal(Object object).
    Note:
    For Android versions of V6.7.2 and earlier, upon clicking cancel or the mask layer, the callback fails, with errMsg being "fail cancel".
    For Android versions 6.7.2 and later, as well as iOS, clicking on the mask layer will not close the modal popup. Therefore, it is advisable to avoid implementing business logic within the cancel branch.
    Feature Description: Displays a modal dialog box.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    title
    string
    -
    No
    The title of the prompt.
    content
    string
    -
    No
    The content of the prompt.
    showCancel
    boolean
    true
    No
    Whether to display the "Cancel" button.
    cancelText
    string
    Cancel
    No
    Text for the "Cancel" button, up to a maximum of 4 characters.
    cancelColor
    string
    #000000
    No
    Text color of the "Cancel" button, which must be a hexadecimal color string.
    confirmText
    string
    Confirm
    No
    Text for the "Confirm" button, limited to a maximum of 4 characters.
    confirmColor
    string
    #576B95
    No
    Text color of the "Confirm" button, which must be a hexadecimal color string.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Parameters for object.success callback function: Object res.
    Attribute
    Type
    Description
    confirm
    boolean
    When set to true, it indicates that the user has clicked the "Confirm" button.
    cancel
    boolean
    When set to true, it indicates that the user has clicked the "Cancel" button (used in the Android system to distinguish between clicking to close the mask layer or clicking the "Cancel" button to close).
    Sample Code
    wx.showModal({
    title: 'Prompt',
    content: 'This is a modal dialog box',
    success (res) {
    if (res.confirm) {
    console.log(User clicked "Confirm")
    } else if (res.cancel) {
    console.log(User clicked "Cancel")
    }
    }
    })

    showToast

    This API is used via wx.showToast(Object object).
    Feature Description: Displays a modal dialog box.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    title
    string
    -
    Yes
    The content of the prompt.
    icon
    string
    success
    No
    Icon, whose valid values are:
    success: Displays the failure icon, when the title text can display up to 7 Chinese characters in length.
    error: Displays the failure icon, when the title text can display up to 7 Chinese characters in length.
    loading: Displays the loading icon, when the title text can display up to 7 Chinese characters in length.
    none: Not to display icons, when the title text can display up to two lines.
    image
    string
    -
    No
    The local path of the custom icon, with the priority of the image higher than that of the icon.
    duration
    number
    1500
    No
    The delay duration of the prompt.
    mask
    boolean
    false
    No
    Whether to display a transparent mask layer to prevent touch penetration.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    Sample Code
    wx.showToast({
    title: 'Success',
    icon: 'success',
    duration: 2000
    })
    Note:
    Only one of wx.showLoading and wx.showToast can be displayed at a time.
    wx.showLoading should be used in conjunction with wx.hideLoading.

    enableAlertBeforeUnload

    This API is used via wx.enableAlertBeforeUnload(Object object).
    Feature Description: Enables the dialog box for asking about the return of the mini program page.
    Popup Conditions:
    When the user is on a non-homepage or bottom-level page within the mini program.
    The return on the official navigation bar.
    Custom return key in full-screen mode.
    When the back key on the Android system is pressed.
    Note:
    No interception is made during gesture slide return.
    Under any circumstances, this feature should not obstruct the user's action of exiting the mini program.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    message
    string
    -
    Yes
    Content of the inquiry dialog box.
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)

    disableAlertBeforeUnload

    This API is used via wx.disableAlertBeforeUnload(Object object).
    Feature Description: Disables the dialog box for asking about the return of the mini program page.
    Parameter and Description: Object.
    Attribute
    Type
    Default value
    Required
    Description
    success
    function
    -
    No
    Callback Function of Successful Interface Call
    fail
    function
    -
    No
    Callback Function of Failing Interface Call
    complete
    function
    -
    No
    Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
    
    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