From 25b7aec25daaa3c1dc92bea6f1fdd2bf5f046c50 Mon Sep 17 00:00:00 2001 From: Guoyuanqiang Date: Tue, 8 Jan 2019 10:57:21 +0800 Subject: [PATCH] fix(module: modal): fix no actions would work error. (#222) --- components/modal/modal.service.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/components/modal/modal.service.ts b/components/modal/modal.service.ts index ec1f27c7..cefbf96f 100644 --- a/components/modal/modal.service.ts +++ b/components/modal/modal.service.ts @@ -98,8 +98,8 @@ export class Modal extends PopupService { const config = Object.assign({ title: title, message: message, - footer: footer ? footer : [{ text: '确定' }], - actions: footer ? footer : [{ text: '确定' }], + footer: footer, + actions: footer, platform: platform ? platform : 'ios' }); @@ -140,9 +140,9 @@ export class Modal extends PopupService { let actions; if (typeof callbackOrActions === 'function') { actions = [ - { text: '取消' }, + { text: 'Cancel' }, { - text: '确定', + text: 'OK', onPress: () => { getArgs(this, callbackOrActions); } @@ -166,8 +166,8 @@ export class Modal extends PopupService { title: title, message: message, type: type ? type : 'default', - footer: footer ? footer : [{ text: '确定' }], - actions: footer ? footer : [{ text: '确定' }], + footer: footer, + actions: footer, platform: platform ? platform : 'ios' }); const props = Modal._initConfig(config, options); @@ -185,8 +185,8 @@ export class Modal extends PopupService { const footer = getFooter(actions); const config = Object.assign({ - footer: footer ? footer : [{ text: '确定' }], - actions: footer ? footer : [{ text: '确定' }], + footer: footer, + actions: footer, platform: platform ? platform : 'ios' }); const props = Modal._initConfig(config, options); @@ -199,7 +199,8 @@ export class Modal extends PopupService { } function getFooter(actions) { - return actions.map((button: Action) => { + let action = actions ? actions : [{ text: 'OK', onPress: () => {}}]; + return action.map((button: Action) => { const orginPress = button.onPress || function() {}; button.onPress = () => { const res = orginPress();