loading box
//显示加载框
uni.showLoading({
title: '加载中'
});
//隐藏加载框
uni.hideLoading();
Isn’t it super simple? This is the loading pop-up window that comes with uniapp. You don’t need to download anything.
Message prompt box (disappears automatically after 2 seconds)
uni.showToast({
title: '暂未此企业信息',//显示的文字
duration: 2000, //显示多少时间,默认1500毫秒
icon: "success" //自定义显示的图标,默认成功success,错误error,加载loading,不显示图标是none
})
//也可以手动隐藏消息提示框
uni.hideToast();
Modal pop-up window (can have only one OK button, or both OK and Cancel buttons)
uni.showModal({
title: '提示', //提示标题
content: '这是一个模态弹窗', //提示内容
showCancel: ture, //是否显示取消按钮,默认ture
success: function (res) {
if (res.confirm) { //confirm为ture,代表点击了确定
console.log('用户点击确定');
} else if (res.cancel) { //cancel为ture,代表点击了取消
console.log('用户点击取消');
}
}
});