From 028747c35471f33e8c2b0baa6fb8915510daac22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Fri, 10 Jan 2020 11:05:08 +0800 Subject: [PATCH] fix(PullRefresh): should set height when using head-height --- src/pull-refresh/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pull-refresh/index.js b/src/pull-refresh/index.js index b1bacf3a6..7215870ea 100644 --- a/src/pull-refresh/index.js +++ b/src/pull-refresh/index.js @@ -5,6 +5,8 @@ import { getScrollTop, getScrollEventTarget } from '../utils/dom/scroll'; import Loading from '../loading'; const [createComponent, bem, t] = createNamespace('pull-refresh'); + +const DEFAULT_HEAD_HEIGHT = 50; const TEXT_STATUS = ['pulling', 'loosing', 'success']; export default createComponent({ @@ -30,7 +32,7 @@ export default createComponent({ }, headHeight: { type: Number, - default: 50 + default: DEFAULT_HEAD_HEIGHT } }, @@ -47,6 +49,14 @@ export default createComponent({ return ( this.status !== 'loading' && this.status !== 'success' && !this.disabled ); + }, + + headStyle() { + if (this.headHeight !== DEFAULT_HEAD_HEIGHT) { + return { + height: `${this.headHeight}px` + }; + } } }, @@ -191,12 +201,12 @@ export default createComponent({ return (
-
{this.genStatus()}
+
+ {this.genStatus()} +
{this.slots()}
); } }); - -//