UNPKG

639 BJavaScriptView Raw
1/**
2 * 弹窗封装
3 * @param {*} content 弹窗内容
4 * @param {*} param1
5 * @param {*} config
6 */
7export const dialog = (content, {comfirm = () => {}, cancel = () => {}}, config = {}) => {
8 wx.showModal({
9 title: config.title || '提示',
10 content: content,
11 showCancel: config.showCancel,
12 cancelText: config.cancelText || '取消',
13 confirmText: config.confirmText || '确定',
14 confirmColor: config.confirmColor || '#00AAFF',
15 cancelColor: config.cancelColor || '#999',
16 success: function(res) {
17 if (res.confirm) {
18 comfirm()
19 } else if (res.cancel) {
20 cancel()
21 }
22 }
23 })
24}