This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
function showActionModal(page, options = {}) {
|
||||
const modal = page && typeof page.selectComponent === 'function' ? page.selectComponent('#actionModal') : null
|
||||
if (modal && typeof modal.open === 'function') {
|
||||
return new Promise(resolve => {
|
||||
modal.open({
|
||||
title: options.title,
|
||||
content: options.content,
|
||||
icon: options.icon,
|
||||
cancelText: options.cancelText,
|
||||
confirmText: options.confirmText,
|
||||
confirmType: options.confirmType,
|
||||
layout: options.layout,
|
||||
editable: options.editable,
|
||||
placeholderText: options.placeholderText,
|
||||
onClose: resolve
|
||||
})
|
||||
})
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
wx.showModal({
|
||||
title: options.title,
|
||||
content: options.content || '',
|
||||
cancelText: options.cancelText,
|
||||
confirmText: options.confirmText,
|
||||
showCancel: !!options.cancelText,
|
||||
editable: options.editable === true,
|
||||
placeholderText: options.placeholderText,
|
||||
success: resolve,
|
||||
fail: () => resolve({ confirm: false, cancel: true, content: '' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = { showActionModal }
|
||||
Reference in New Issue
Block a user