From 9c5ad689eb9fa5af2ebe86de607813cb2228e53d Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 13 Apr 2021 11:24:22 +0800 Subject: [PATCH] chore(@vant/lazyload): remove @babel/runtime --- packages/vant-lazyload/package.json | 1 - packages/vant-lazyload/src/lazy-container.js | 7 +++---- packages/vant-lazyload/src/lazy.js | 5 +---- packages/vant-lazyload/yarn.lock | 12 ------------ 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/packages/vant-lazyload/package.json b/packages/vant-lazyload/package.json index 9b0dcdc7a..a4a907b4f 100644 --- a/packages/vant-lazyload/package.json +++ b/packages/vant-lazyload/package.json @@ -23,7 +23,6 @@ "devDependencies": { "@babel/cli": "^7.12.8", "@babel/core": "^7.12.9", - "@babel/runtime": "7.x", "release-it": "^14.2.2", "vue": "^3.0.0" }, diff --git a/packages/vant-lazyload/src/lazy-container.js b/packages/vant-lazyload/src/lazy-container.js index 08698e35f..f0518e284 100644 --- a/packages/vant-lazyload/src/lazy-container.js +++ b/packages/vant-lazyload/src/lazy-container.js @@ -19,14 +19,13 @@ class LazyContainer { update({ el, binding }) { this.el = el; - this.options = { ...defaultOptions, ...binding.value }; + this.options = Object.assign({}, defaultOptions, binding.value); const imgs = this.getImgs(); imgs.forEach((el) => { this.lazy.add( el, - { - ...this.binding, + Object.assign({}, this.binding, { value: { src: 'dataset' in el ? el.dataset.src : el.getAttribute('data-src'), error: @@ -38,7 +37,7 @@ class LazyContainer { ? el.dataset.loading : el.getAttribute('data-loading')) || this.options.loading, }, - }, + }), this.vnode ); }); diff --git a/packages/vant-lazyload/src/lazy.js b/packages/vant-lazyload/src/lazy.js index d6cf14d74..debd573c2 100644 --- a/packages/vant-lazyload/src/lazy.js +++ b/packages/vant-lazyload/src/lazy.js @@ -91,10 +91,7 @@ export default function () { * @return */ config(options = {}) { - this.options = { - ...this.options, - options, - }; + Object.assign(this.options, options); } /** diff --git a/packages/vant-lazyload/yarn.lock b/packages/vant-lazyload/yarn.lock index 2a6f4b20b..4cb0f31e5 100644 --- a/packages/vant-lazyload/yarn.lock +++ b/packages/vant-lazyload/yarn.lock @@ -161,13 +161,6 @@ resolved "https://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.12.7.tgz?cache=0&sync_timestamp=1605906390839&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fparser%2Fdownload%2F%40babel%2Fparser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056" integrity sha1-/uezn+gJ0Oc+WyXuyvV4DvPXMFY= -"@babel/runtime@7.x": - version "7.12.5" - resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.12.5.tgz?cache=0&sync_timestamp=1604441208794&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" - integrity sha1-QQ5+SHRB4bNgwpvnFdhw2bmFiC4= - dependencies: - regenerator-runtime "^0.13.4" - "@babel/template@^7.10.4", "@babel/template@^7.12.7": version "7.12.7" resolved "https://registry.npm.taobao.org/@babel/template/download/@babel/template-7.12.7.tgz?cache=0&sync_timestamp=1605906405753&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftemplate%2Fdownload%2F%40babel%2Ftemplate-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc" @@ -2284,11 +2277,6 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" -regenerator-runtime@^0.13.4: - version "0.13.7" - resolved "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" - integrity sha1-ysLazIoepnX+qrrriugziYrkb1U= - regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.npm.taobao.org/regex-not/download/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"