[new feature] NumberKeyboard: add title-left slot (#3194)

This commit is contained in:
neverland
2019-04-22 19:51:42 +08:00
committed by GitHub
parent c9d6222ab1
commit 493860134a
8 changed files with 53 additions and 5 deletions

View File

@@ -133,8 +133,11 @@ export default sfc({
},
render(h) {
const { theme, onPress, closeButtonText } = this;
const { title, theme, onPress, closeButtonText } = this;
const titleLeftSlot = this.slots('title-left');
const showTitleClose = closeButtonText && theme === 'default';
const showTitle = title || showTitleClose || titleLeftSlot;
return (
<transition name={this.transition ? 'van-slide-up' : ''}>
@@ -146,9 +149,14 @@ export default sfc({
onAnimationend={this.onAnimationEnd}
onWebkitAnimationEnd={this.onAnimationEnd}
>
{(this.title || showTitleClose) && (
{showTitle && (
<div class={[bem('title'), 'van-hairline--top']}>
<span>{this.title}</span>
{titleLeftSlot && (
<span class={bem('title-left')}>
{titleLeftSlot}
</span>
)}
{title && <span>{title}</span>}
{showTitleClose && (
<span class={bem('close')} onClick={this.onClose}>
{closeButtonText}