dialog.js 556 B

123456789101112131415161718192021222324252627
  1. let dialog = {};
  2. /**
  3. * 封装模态框
  4. */
  5. dialog.showModal = (content, isShowCancel = true, title = '提示',) => {
  6. return new Promise((resolve, reject) => {
  7. uni.showModal({
  8. title: title,
  9. content: content,
  10. showCancel: isShowCancel,
  11. success: (res) => {
  12. if (res.confirm) {
  13. resolve(res)
  14. }
  15. }
  16. });
  17. })
  18. }
  19. dialog.showLoading = (title = '加载中...') => {
  20. uni.showLoading({
  21. title
  22. })
  23. }
  24. export default dialog