uni-app几种常用的提示框

1、成功提示框

提交的时候,提交成功弹出的提示框。

uni.showToast({
	title: '提交成功',
	duration: 3000//单位毫秒
});

2、加载框

uni.showLoading({
title: '加载中'
});

setTimeout(function () {
uni.hideLoading();
}, 2000);

在这里插入图片描述

3、去掉图标,只显示文字提示框

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

在这里插入图片描述

4、模态弹窗

uni.showModal({
	title: '警告',
	content: '注销账号会清除账号下的所有数据!您确认要注销吗?',
	cancelText: "考虑一下", // 取消按钮的文字  
	confirmText: "确认删除", // 确认按钮文字 
	confirmColor:'#F54E40',//确认字体的颜色
	cancelColor:'#000',//取消字体的颜色
	success: function (res) {
		if (res.confirm) {
			console.log('用户点击确定');
		} else if (res.cancel) {
			console.log('用户点击取消');
		}
	}
});

在这里插入图片描述

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐