12 changed files with 152 additions and 107 deletions
@ -0,0 +1,56 @@ |
|||
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(); |
|||
}, |
|||
}); |
|||
}); |
|||
}, |
|||
}; |
Loading…
Reference in new issue