From a6b429cf58b47e21751a0622bb8b7ebc927298b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 13 May 2019 20:12:43 +0800 Subject: [PATCH] [improvement] PullRefresh: optimize loading --- packages/pull-refresh/index.js | 6 +---- .../test/__snapshots__/index.spec.js.snap | 4 ++-- packages/toast/Toast.js | 22 +++++++++---------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/pull-refresh/index.js b/packages/pull-refresh/index.js index 5b305b23c..6d7c8affb 100644 --- a/packages/pull-refresh/index.js +++ b/packages/pull-refresh/index.js @@ -150,11 +150,7 @@ export default sfc({ const Status = this.slots(status) || [ TEXT_STATUS.indexOf(status) !== -1 &&
{text}
, - status === 'loading' && ( - - {text} - - ) + status === 'loading' && {text} ]; return ( diff --git a/packages/pull-refresh/test/__snapshots__/index.spec.js.snap b/packages/pull-refresh/test/__snapshots__/index.spec.js.snap index c378c91c9..be82e3e21 100644 --- a/packages/pull-refresh/test/__snapshots__/index.spec.js.snap +++ b/packages/pull-refresh/test/__snapshots__/index.spec.js.snap @@ -24,7 +24,7 @@ exports[`change head content when pulling down 3`] = `
-
加载中...
+
加载中...
@@ -34,7 +34,7 @@ exports[`change head content when pulling down 4`] = `
-
加载中...
+
加载中...
diff --git a/packages/toast/Toast.js b/packages/toast/Toast.js index ac5490b01..1b9705d41 100644 --- a/packages/toast/Toast.js +++ b/packages/toast/Toast.js @@ -67,23 +67,23 @@ export default sfc({ const { type, message } = this; const style = STYLE.indexOf(type) !== -1 ? 'default' : type; - const Content = () => { + function Content() { switch (style) { case 'text': return
{message}
; case 'html': return
; - default: - return [ - type === 'loading' ? ( - - ) : ( - - ), - isDef(message) &&
{message}
- ]; } - }; + + return [ + type === 'loading' ? ( + + ) : ( + + ), + isDef(message) &&
{message}
+ ]; + } return (