feat(Picker): add confirm、cancel slot (#7377)

This commit is contained in:
neverland
2020-10-21 18:27:24 +08:00
committed by GitHub
parent 83095c7d1e
commit dabd984070
5 changed files with 64 additions and 27 deletions
+18 -10
View File
@@ -270,22 +270,30 @@ export default createComponent({
}
},
genCancel() {
return (
<button type="button" class={bem('cancel')} onClick={this.cancel}>
{this.slots('cancel') || this.cancelButtonText || t('cancel')}
</button>
);
},
genConfirm() {
return (
<button type="button" class={bem('confirm')} onClick={this.confirm}>
{this.slots('confirm') || this.confirmButtonText || t('confirm')}
</button>
);
},
genToolbar() {
if (this.showToolbar) {
return (
<div class={bem('toolbar')}>
{this.slots() || [
<button type="button" class={bem('cancel')} onClick={this.cancel}>
{this.cancelButtonText || t('cancel')}
</button>,
this.genCancel(),
this.genTitle(),
<button
type="button"
class={bem('confirm')}
onClick={this.confirm}
>
{this.confirmButtonText || t('confirm')}
</button>,
this.genConfirm(),
]}
</div>
);