dialog.js 457 B

12345678910111213141516171819202122232425262728
  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. confirmColor:"#5a3ee8",
  11. showCancel:isShowCancel,
  12. success: (res)=>{
  13. if (res.confirm) {
  14. resolve(res)
  15. }
  16. }
  17. });
  18. })
  19. }
  20. dialog.showLoading=(title='加载中...')=>{
  21. uni.showLoading({
  22. title
  23. })
  24. }
  25. export default dialog