uni.showModal(options)
uni.showModal 函数定义
弹出modal
参数
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 | 是 | 错误信息 |