跳到主要内容

mgtv.showModal(Object object)

框架版本 0.1.1 开始支持。

显示模态对话框。

参数

Object object

属性类型默认值必填说明
titlestring提示的标题
contentstring提示的内容
showCancelbooleantrue是否显示取消按钮
cancelTextstring取消取消按钮的文字,最多 4 个字符
cancelColorstring#000000取消按钮的文字颜色,必须是 16 进制格式的颜色字符串
confirmTextstring确定确认按钮的文字,最多 4 个字符
confirmColorstring#576B95确认按钮的文字颜色,必须是 16 进制格式的颜色字符串
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数
completefunction接口调用结束的回调函数(调用成功、失败都会执行)

object.success

参数

Object res

属性类型说明
contentstringeditable 为 true 时,用户输入的文本
confirmboolean为 true 时,表示用户点击了确定按钮
cancelboolean为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭

示例代码

mgtv.showModal({
title: "提示",
content: "确认删除当前商品?",
success(res) {
if (res.confirm) {
console.log("确定");
} else if (res.cancel) {
console.log("取消");
}
},
});