From 4006a86cec5f2cc4ae7fd0a8a7be883eae75b559 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 13 Mar 2018 16:36:56 +0800 Subject: [PATCH] [Improvement] PullRefresh: support trigger loading animation (#684) --- docs/demos/views/pull-refresh.vue | 2 +- packages/pull-refresh/index.vue | 6 ++---- test/specs/sku.spec.js | 8 +++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/demos/views/pull-refresh.vue b/docs/demos/views/pull-refresh.vue index f63c6c214..a8ed2990f 100644 --- a/docs/demos/views/pull-refresh.vue +++ b/docs/demos/views/pull-refresh.vue @@ -45,7 +45,7 @@ export default { .van-pull-refresh { &, &__track { - height: 100%; + height: calc(100vh - 50px); } } diff --git a/packages/pull-refresh/index.vue b/packages/pull-refresh/index.vue index c895dcd36..9646d81cd 100644 --- a/packages/pull-refresh/index.vue +++ b/packages/pull-refresh/index.vue @@ -76,10 +76,8 @@ export default create({ watch: { value(val) { - if (!val) { - this.duration = this.animationDuration; - this.getStatus(0); - } + this.duration = this.animationDuration; + this.getStatus(val ? this.headHeight : 0, val); } }, diff --git a/test/specs/sku.spec.js b/test/specs/sku.spec.js index f687a13cf..4fbf01613 100644 --- a/test/specs/sku.spec.js +++ b/test/specs/sku.spec.js @@ -4,7 +4,6 @@ import Toast from 'packages/toast'; import { mount } from 'avoriaz'; import { DOMChecker } from '../utils'; import skuMockData from '../../docs/demos/mock/sku'; -import repeat from 'lodash/repeat'; const data = skuMockData['zh-CN']; const { skuHelper } = Sku; @@ -13,6 +12,13 @@ const initialSku = { s1: '30349', s2: '1193' }; +const repeat = (str, count) => { + let result = ''; + for (let i = 0; i < count; i++) { + result += str; + } + return result; +}; const File = function() { this.name = 'test';