tencent cloud

文档反馈

最后更新时间:2024-03-04 23:01:18

    hideLoading

    该 API 使用方法为 wx.hideLoading(Object object)
    功能说明:隐藏 loading 提示框。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    hideToast

    该 API 使用方法为 wx.hideToast(Object object)
    功能描述:隐藏消息提示框。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    showActionSheet

    该 API 使用方法为 wx.showActionSheet(Object object)
    注意:
    Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
    Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
    功能描述:显示操作菜单。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    itemList
    array.<string>
    -
    按钮的文字数组,数组长度最大为6
    itemColor
    string
    #000000
    按钮的文字颜色
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    object.success 回调函数参数:Object res
    属性
    类型
    说明
    tapIndex
    number
    用户单击的按钮序号,从上到下的顺序,从0开始
    示例代码
    wx.showActionSheet({
    itemList: ['A', 'B', 'C'],
    success (res) {
    console.log(res.tapIndex)
    },
    fail (res) {
    console.log(res.errMsg)
    }
    })

    showLoading

    该 API 使用方法为 wx.showLoading(Object object)
    功能说明:显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框 。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    title
    string
    -
    提示的内容
    mask
    boolean
    false
    是否显示透明蒙层,防止触摸穿透
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    示例代码
    wx.showLoading({
    title: '加载中',
    })
    
    setTimeout(function () {
    wx.hideLoading()
    }, 2000)
    注意:
    wx.showLoadingwx.showToast 同时只能显示一个。
    wx.showLoading 应与 wx.hideLoading 配对使用。

    showModal

    该 API 使用方法为 wx.showModal(Object object)
    注意:
    Android 6.7.2 以下版本,单击取消或蒙层时,回调 fail, errMsg 为 "fail cancel"。
    Android 6.7.2 及以上版本和 iOS 单击蒙层不会关闭模态弹窗,所以尽量避免使用取消分支中实现业务逻辑。
    功能说明:显示模态对话框。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    title
    string
    -
    提示的标题
    content
    string
    -
    提示的内容
    showCancel
    boolean
    true
    是否显示取消按钮
    cancelText
    string
    取消
    取消按钮的文字,最多4个字符
    cancelColor
    string
    #000000
    取消按钮的文字颜色,必须是16进制格式的颜色字符串
    confirmText
    string
    确定
    确认按钮的文字,最多4个字符
    confirmColor
    string
    #576B95
    确认按钮的文字颜色,必须是16进制格式的颜色字符串
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    object.success 回调函数参数:Object res
    属性
    类型
    说明
    confirm
    boolean
    为 true 时,表示用户单击了确定按钮
    cancel
    boolean
    为 true 时,表示用户单击了取消(用于 Android 系统区分单击蒙层关闭还是单击取消按钮关闭)
    示例代码
    wx.showModal({
    title: '提示',
    content: '这是一个模态弹窗',
    success (res) {
    if (res.confirm) {
    console.log('用户点击确定')
    } else if (res.cancel) {
    console.log('用户点击取消')
    }
    }
    })

    showToast

    该 API 使用方法为 wx.showToast(Object object)
    功能说明:显示模态对话框。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    title
    string
    -
    提示的内容
    icon
    string
    success
    图标,其合法值为:
    success:显示失败图标,此时 title 文本最多显示 7 个汉字长度
    error:显示失败图标,此时 title 文本最多显示 7 个汉字长度
    loading:显示加载图标,此时 title 文本最多显示 7 个汉字长度
    none:不显示图标,此时 title 文本最多可显示两行
    image
    string
    -
    自定义图标的本地路径,image 的优先级高于 icon
    duration
    number
    1500
    提示的延迟时间
    mask
    boolean
    false
    是否显示透明蒙层,防止触摸穿透
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    示例代码
    wx.showToast({
    title: '成功',
    icon: 'success',
    duration: 2000
    })
    注意:
    wx.showLoadingwx.showToast 同时只能显示一个。
    wx.showLoading 应与 wx.hideLoading 配对使用。

    enableAlertBeforeUnload

    该 API 使用方法为 wx.enableAlertBeforeUnload(Object object)
    功能说明:开启小程序页面返回询问对话框。
    弹窗条件:
    当用户在小程序内非首页页面/最底层页。
    官方导航栏上的返回。
    全屏模式下自绘返回键。
    android 系统 back 键时。
    注意:
    手势滑动返回时不做拦截。
    在任何场景下,此功能都不应拦住用户退出小程序的行为。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    message
    string
    -
    询问对话框内容
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)

    disableAlertBeforeUnload

    该 API 使用方法为 wx.disableAlertBeforeUnload(Object object)
    功能说明:关闭小程序页面返回询问对话框。
    参数及说明:Object object。
    属性
    类型
    默认值
    必填
    说明
    success
    function
    -
    接口调用成功的回调函数
    fail
    function
    -
    接口调用失败的回调函数
    complete
    function
    -
    接口调用结束的回调函数(调用成功、失败都会执行)
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持