You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.0 KiB
56 lines
1.0 KiB
export default {
|
|
/**
|
|
* 显示toast
|
|
* @param {string} title 提示内容
|
|
* @param {number} duration 显示时间 默认2000
|
|
*/
|
|
showToast(title, duration = 2000) {
|
|
return uni.showToast({
|
|
title,
|
|
icon: 'none',
|
|
duration,
|
|
mask: true,
|
|
});
|
|
},
|
|
|
|
// 隐藏toast
|
|
hideToast() {
|
|
return uni.hideToast();
|
|
},
|
|
|
|
/**
|
|
* 显示加载雪花
|
|
* @param {string} title
|
|
*/
|
|
showLoading(title = '玩命加载中...') {
|
|
return uni.showLoading({
|
|
title,
|
|
mask: true,
|
|
});
|
|
},
|
|
|
|
// 隐藏loading
|
|
hideLoading() {
|
|
return uni.hideLoading();
|
|
},
|
|
|
|
/**
|
|
* 显示modal弹出框
|
|
* @param {string} title 标题
|
|
* @param {string} content 内容
|
|
* @param {boolean} showCancel 是否显示取消按钮 默认true
|
|
*/
|
|
showModal(title, content, showCancel = true) {
|
|
return new Promise(function(resolve, reject) {
|
|
uni.showModal({
|
|
title,
|
|
content,
|
|
showCancel,
|
|
success: ({ confirm, cancel }) => {
|
|
confirm && resolve();
|
|
cancel && reject();
|
|
},
|
|
});
|
|
});
|
|
},
|
|
};
|
|
|