modalUtil.js 849 B

12345678910111213141516171819202122232425262728
  1. /**
  2. * showModal 弹框封装
  3. * @property {String} title 标题
  4. * @property {String} content 内容
  5. * @property {String} confirmText 确定按钮文案,默认(确定)
  6. * @property {Function} confirmCallBack 确定按钮事件
  7. * @property {String} cancelText 取消按钮文案,默认 不显示取消按键
  8. * @property {Function} cancelCallBack 取消按钮事件
  9. */
  10. export const showModal = ({title,content,confirmText,confirmCallBack,cancelText,cancelCallBack})=>{
  11. uni.showModal({
  12. title,
  13. content: content,
  14. showCancel:cancelText?true:false,
  15. confirmText: confirmText || '确定',
  16. cancelText:cancelText || '取消',
  17. cancelColor: '#333333',
  18. confirmColor: '#FF7400',
  19. success: (res) => {
  20. if (res.confirm) {
  21. confirmCallBack && confirmCallBack()
  22. }else{
  23. cancelCallBack && cancelCallBack()
  24. }
  25. }
  26. })
  27. }