uniapp常用提示框uni.showToast(OBJECT)

2022-08-02,,,,

记录一下开发经常会用到的几种提示
前端代码里最常用的,以免忘记了。

官方参考文档:https://uniapp.dcloud.io/api/ui/prompt?id=showtoast

1:成功提示
提交表单的时候,如果提交成功

uni.showToast({
title: '提交成功',
duration: 2000
});

2:加载框

uni.showLoading({
					    title: '加载中'
					});
					
					setTimeout(function () {
					    uni.hideLoading();
					}, 2000);

3:去掉图标,只显示文字

uni.showToast({
title: '请填写员工工号',
icon:'none',
duration: 2000
});

4:模态弹窗

uni.showModal({
					    title: '提示',
					    content: '这是一个模态弹窗',
					    success: function (res) {
					        if (res.confirm) {
					            console.log('用户点击确定');
					        } else if (res.cancel) {
					            console.log('用户点击取消');
					        }
					    }
					});

本文地址:https://blog.csdn.net/weixin_44763569/article/details/107381940

《uniapp常用提示框uni.showToast(OBJECT).doc》

下载本文的Word格式文档,以方便收藏与打印。