赞
踩
uni.showToast({
title: '只有文字弹窗',
icon: 'none', //如果要纯文本,不要icon,将值设为'none'
duration: 2000 //持续时间为 2秒
})
uni.showToast({
title: '成功提示弹窗',
icon: 'success', //将值设置为 success 或者 ''
duration: 2000 //持续时间为 2秒
})
uni.showModal({
title: '有确认取消的弹窗',
content: '确认要删除该项吗?',
success: function(res) {
if (res.confirm) {
console.log('点击了确认')
} else {
console.log('点击了取消')
}
}
})
uni.showToast({
title: '自定义图标弹窗',
//图片优先级更高但您应该使用本地的而非线上的图片链接
image: '../../static/logo.png',
duration: 2000
})
//showLoading 需要用hideLoading来结束,一般网络请求封装中常用
uni.showLoading({
title:'加载中...'
});
setTimeout(()=>{
uni.hideLoading()
},2000)
//如果有透明蒙层,相当于全屏 不能做其他操作如点击事件
uni.showToast({
title: '遮罩层的弹窗',
duration: 2000,
mask: true //是否有透明蒙层,默认为false
})
uni.showActionSheet({
itemList: ['A', 'B', 'C'],
success (res) {
console.log(res.tapIndex)
},
fail (res) {
console.log(res.errMsg)
}
})
附加和可能出现的有用信息已添加注释
其他有关uniapp的疑问或者此方法不理解的地方您可留言,我会尽快回复并帮您解决。
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。