From cb992ce97966aa902223571467a0a94254cf89c9 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 23 May 2018 11:01:27 +0800 Subject: [PATCH] [Improvement] Popup: support lazy render (#1138) --- packages/address-edit/index.vue | 2 +- packages/contact-card/demo/index.vue | 4 +- packages/coupon-list/demo/index.vue | 2 +- packages/mixins/popup/index.js | 6 +- packages/mixins/popup/manager.js | 1 + packages/popup/en-US.md | 1 + packages/popup/index.vue | 18 ++- .../test/__snapshots__/demo.spec.js.snap | 40 +----- .../test/__snapshots__/index.spec.js.snap | 3 + packages/popup/test/index.spec.js | 126 ++++++++++++++++++ packages/popup/zh-CN.md | 1 + .../sku/test/__snapshots__/demo.spec.js.snap | 26 +++- packages/tab/index.vue | 8 +- test/touch-utils.js | 34 +++++ 14 files changed, 223 insertions(+), 49 deletions(-) create mode 100644 packages/popup/test/__snapshots__/index.spec.js.snap create mode 100644 packages/popup/test/index.spec.js create mode 100644 test/touch-utils.js diff --git a/packages/address-edit/index.vue b/packages/address-edit/index.vue index b99a7548b..db43ab9a8 100644 --- a/packages/address-edit/index.vue +++ b/packages/address-edit/index.vue @@ -65,7 +65,7 @@ {{ $t('deleteAddress') }} - + - + - + - + { + this.$el.style.zIndex = context.plusKey('zIndex'); + }); } } }; diff --git a/packages/mixins/popup/manager.js b/packages/mixins/popup/manager.js index 68649bb8a..0dc93b53a 100644 --- a/packages/mixins/popup/manager.js +++ b/packages/mixins/popup/manager.js @@ -61,6 +61,7 @@ export default { // close popup when click modal && closeOnClickOverlay is true onClick() { + /* istanbul ignore else */ if (context.top) { const { vm } = context.top; vm.$emit('click-overlay'); diff --git a/packages/popup/en-US.md b/packages/popup/en-US.md index fe6012540..29265a2cf 100644 --- a/packages/popup/en-US.md +++ b/packages/popup/en-US.md @@ -47,6 +47,7 @@ Use `position` prop to set popup display position | close-on-click-overlay | Close popup when click overlay | `Boolean` | `true` | | transition | Transition | `String` | `popup-slide` | | lock-scroll | Whether to lock background scroll | `Boolean` | `true` | +| lazy-render | Whether to lazy render util appeared | `Boolean` | `true` | | get-container | Return the mount node for Popup | `() => HTMLElement` | - | ### Event diff --git a/packages/popup/index.vue b/packages/popup/index.vue index 74d2733a2..3fdc494a3 100644 --- a/packages/popup/index.vue +++ b/packages/popup/index.vue @@ -1,6 +1,6 @@