diff --git a/src/dialog/Dialog.js b/src/dialog/Dialog.js
index 621e38c6d..3f3005257 100644
--- a/src/dialog/Dialog.js
+++ b/src/dialog/Dialog.js
@@ -91,6 +91,39 @@ export default createComponent({
onClosed() {
this.$emit('closed');
},
+
+ genButtons() {
+ const multiple = this.showCancelButton && this.showConfirmButton;
+
+ return (
+
+ {this.showCancelButton && (
+
+ );
+ },
},
render() {
@@ -122,36 +155,6 @@ export default createComponent({
);
- const hasButtons = this.showCancelButton && this.showConfirmButton;
- const ButtonGroup = (
-
- {this.showCancelButton && (
- {
- this.handleAction('cancel');
- }}
- />
- )}
- {this.showConfirmButton && (
- {
- this.handleAction('confirm');
- }}
- />
- )}
-
- );
-
return (
{Title}
{Content}
- {ButtonGroup}
+ {this.genButtons()}
);
diff --git a/src/number-keyboard/index.js b/src/number-keyboard/index.js
index b46494545..29a57489a 100644
--- a/src/number-keyboard/index.js
+++ b/src/number-keyboard/index.js
@@ -134,83 +134,92 @@ export default createComponent({
this.$emit('update:value', value + text);
}
},
+
+ genTitle() {
+ const { title, theme, closeButtonText } = this;
+ const titleLeft = this.slots('title-left');
+ const showClose = closeButtonText && theme === 'default';
+ const showTitle = title || showClose || titleLeft;
+
+ if (!showTitle) {
+ return;
+ }
+
+ return (
+
+ {titleLeft && {titleLeft}}
+ {title && {title}}
+ {showClose && (
+
+ {closeButtonText}
+
+ )}
+
+ );
+ },
+
+ genKeys() {
+ return this.keys.map(key => (
+
+ {key.type === 'delete' && this.slots('delete')}
+ {key.type === 'extra' && this.slots('extra-key')}
+
+ ));
+ },
+
+ genSidebar() {
+ if (this.theme === 'custom') {
+ return (
+
+ );
+ }
+ },
},
render() {
- const { title, theme, onPress, closeButtonText } = this;
-
- const titleLeftSlot = this.slots('title-left');
- const showTitleClose = closeButtonText && theme === 'default';
- const showTitle = title || showTitleClose || titleLeftSlot;
-
- const Title = showTitle && (
-
- {titleLeftSlot && (
- {titleLeftSlot}
- )}
- {title && {title}}
- {showTitleClose && (
-
- {closeButtonText}
-
- )}
-
- );
-
- const Keys = this.keys.map(key => (
-
- {key.type === 'delete' && this.slots('delete')}
- {key.type === 'extra' && this.slots('extra-key')}
-
- ));
-
- const Sidebar = theme === 'custom' && (
-
- );
-
return (
- {Title}
+ {this.genTitle()}
- {Keys}
- {Sidebar}
+ {this.genKeys()}
+ {this.genSidebar()}