# uni.showToast(options)

显示消息提示框

# # 参数

名称 类型 必填 默认值 描述
options ShowToastOptions 是 - uni.showToast参数定义

# # ShowToastOptions 属性值

名称 类型 必备 默认值 描述
title string 是 - 提示的内容,长度与 icon 取值有关。
icon string 否 - icon值说明 success: 显示成功图标,error: 显示错误图标; fail: 显示错误图标,此时title文本无长度显示; exception: 显示异常图标,此时title文本无长度显示; loading: 显示加载图标;none: 不显示图标。
image string 否 - 自定义图标的本地路径(app端暂不支持gif)
mask boolean 否 - 是否显示透明蒙层,防止触摸穿透,默认:false
duration number 否 - 提示的延迟时间,单位毫秒,默认:1500
position string 否 - position值说明(仅App生效) top: 居上显示; center: 居中显示;bottom: 居底显示
success (res: ShowToastSuccess) => void 否 - 接口调用成功的回调函数
fail (res: UniError) => void 否 - 接口调用失败的回调函数
complete (res: any) => void 否 - 接口调用结束的回调函数(调用成功、失败都会执行)

# # showToast 兼容性

安卓系统版本 安卓 uni-app 安卓 uni-app-x iOS 系统版本 iOS uni-app iOS uni-app-x
4.4.4 √ 3.9.0 9.0 √ 3.9.0

# # 参见

showToast

# # 通用类型

# # GeneralCallbackResult

名称 类型 必备 默认值 描述
errMsg string 是 - 错误信息