uniapp显示提示框背景变暗_uni-app 提示框

本文介绍了uni-app中显示提示信息的两种方法:uni.showToast和uni.showModal,详细讲解了各自参数及用法,并提到了官方插件市场的自定义提示框组件资源。
摘要由CSDN通过智能技术生成

uni-app官网提供的两种显示方式:

第一种

uni.showToast

/*

title {string} 提示的内容,长度与 icon 取值有关。

icon {string} 图标

image {string} 自定义图标的本地路径

mask {boolean} 遮罩层

duration {number} 持续时间 默认1500

position {string} 显示位置 'top','center','bottom'

success {function} 成功的回调

fail {function} 失败的回调

complete {function} 结束的回调

*/

uni.showToast({

title: '标题',

duration: 2000

});

uni.hideToast(); //隐藏提示框

第二种

uni.showModal

/*

title {string} 提示的标题

content {string} 提示的内容

showCancel {boolean} 是否显示关闭按钮 true

cancelText {string} 取消按钮的文字,"取消",最多四个字符

cancelColor {HexColor} 取消按钮的文字颜色

confirmText {string} 确认按钮的文字,"取消",最多四个字符

confirmColor {HexColor} 确认按钮的文字颜色

success {function} 成功的回调

fail {function} 失败的回调

complete {function} 结束的回调

*/

uni.showModal({

title: '提示',

content: '这是一个模态弹窗',

success: function (res) {

if (res.confirm) {

console.log('用户点击确定');

} else if (res.cancel) {

console.log('用户点击取消');

}

}

});

官方的插件市场还有一些大神封装的提示框组件,有兴趣的可以参考下。附上链接

标签:function,回调,string,title,app,按钮,uni,提示框

来源: https://blog.csdn.net/zhuoganliwanjin/article/details/81872358

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值