[new feature] Button: add loading-text prop (#2732)

This commit is contained in:
neverland
2019-02-13 19:02:30 +08:00
committed by GitHub
parent d7c337710c
commit 4418bb9842
6 changed files with 30 additions and 15 deletions

View File

@@ -16,6 +16,7 @@ export default sfc({
loading: Boolean,
disabled: Boolean,
nativeType: String,
loadingText: String,
bottomAction: Boolean,
tag: {
type: String,
@@ -33,7 +34,7 @@ export default sfc({
render(h, context) {
const { props } = context;
const { type, disabled, loading } = props;
const { type, disabled, loading, loadingText } = props;
const onClick = event => {
if (!loading && !disabled) {
@@ -62,7 +63,12 @@ export default sfc({
{...inherit(context)}
>
{loading ? (
<Loading size="20px" color={type === 'default' ? undefined : ''} />
[
<Loading size="20px" color={type === 'default' ? undefined : ''} />,
loadingText && (
<span class={bem('loading-text')}>{loadingText}</span>
)
]
) : (
<span class={bem('text')}>{context.children || props.text}</span>
)}