# uni.showModal(options)

uni.showModal 函数定义

弹出modal

# # 参数

名称 类型 必填 描述
options ShowModalOptions uni.showModal 参数定义

# # ShowModalOptions

名称 类型 必填 描述
title string 提示的标题
content string 提示的内容
showCancel boolean
cancelText string 取消按钮的文字,默认为"取消"
cancelColor string 取消按钮的文字颜色,默认为"#000000"
confirmText string 确定按钮的文字,默认为"确定"
confirmColor string 确定按钮的文字颜色
editable boolean
placeholderText string 显示输入框时的提示文本
success (ShowModalSuccess) => void 接口调用成功的回调函数
fail (UniError) => void 接口调用失败的回调函数
complete (any) => void 接口调用结束的回调函数(调用成功、失败都会执行)
# # ShowModalSuccess
名称 类型 必填 描述
confirm boolean 为 true 时,表示用户点击了确定按钮
cancel boolean 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭)
content string editable 为 true 时,用户输入的文本

# # 兼容性

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

# # 参见

showModal

# # 通用类型

# # GeneralCallbackResult

名称 类型 必填 描述
errMsg string 错误信息