feat(Search): add action-text prop (#4501)

This commit is contained in:
neverland
2019-09-19 11:17:16 +08:00
committed by GitHub
parent a4b5f94232
commit 95c9fea1f7
6 changed files with 46 additions and 10 deletions
+7 -1
View File
@@ -17,6 +17,7 @@ export type SearchProps = {
rightIcon?: string;
clearable: boolean;
background: string;
actionText?: string;
showAction?: boolean;
};
@@ -58,7 +59,11 @@ function Search(
return (
<div class={bem('action')}>
{slots.action ? slots.action() : <div onClick={onCancel}>{t('cancel')}</div>}
{slots.action ? (
slots.action()
) : (
<div onClick={onCancel}>{props.actionText || t('cancel')}</div>
)}
</div>
);
}
@@ -112,6 +117,7 @@ Search.props = {
value: String,
label: String,
rightIcon: String,
actionText: String,
showAction: Boolean,
shape: {
type: String,