feat(Picker): add confirm method

This commit is contained in:
陈嘉涵
2019-12-29 09:03:27 +08:00
committed by neverland
parent d7ae8c5a26
commit 5eb2a4012a
4 changed files with 10 additions and 5 deletions
+6 -5
View File
@@ -153,12 +153,13 @@ export default createComponent({
});
},
onConfirm() {
this.children.map(child => child.stopMomentum());
// @exposed-api
confirm() {
this.children.forEach(child => child.stopMomentum());
this.emit('confirm');
},
onCancel() {
cancel() {
this.emit('cancel');
},
@@ -182,7 +183,7 @@ export default createComponent({
<button
type="button"
class={bem('cancel')}
onClick={this.onCancel}
onClick={this.cancel}
>
{this.cancelButtonText || t('cancel')}
</button>,
@@ -190,7 +191,7 @@ export default createComponent({
<button
type="button"
class={bem('confirm')}
onClick={this.onConfirm}
onClick={this.confirm}
>
{this.confirmButtonText || t('confirm')}
</button>