From 7bfceb508e9cfa5b271e751f28c65f936c414423 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Tue, 13 Apr 2021 11:24:04 +0800 Subject: [PATCH] chore(@vant/use): remove @babel/runtime --- packages/vant-use/package.json | 3 --- .../vant-use/src/useRelation/useChildren.ts | 19 ++++++++++++------- .../vant-use/src/useRelation/useParent.ts | 4 ++-- packages/vant-use/yarn.lock | 7 ------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/vant-use/package.json b/packages/vant-use/package.json index 3f4c88fb0..238337b90 100644 --- a/packages/vant-use/package.json +++ b/packages/vant-use/package.json @@ -24,9 +24,6 @@ }, "license": "MIT", "repository": "https://github.com/youzan/vant/tree/dev/packages/vant-use", - "dependencies": { - "@babel/runtime": "7.x" - }, "devDependencies": { "@babel/core": "^7.12.9", "gh-pages": "^3.1.0", diff --git a/packages/vant-use/src/useRelation/useChildren.ts b/packages/vant-use/src/useRelation/useChildren.ts index 6a7610af5..d9afd36c4 100644 --- a/packages/vant-use/src/useRelation/useChildren.ts +++ b/packages/vant-use/src/useRelation/useChildren.ts @@ -78,13 +78,18 @@ export function useChildren< internalChildren.splice(index, 1); }; - provide(key, { - link, - unlink, - children: publicChildren, - internalChildren, - ...value, - }); + provide( + key, + Object.assign( + { + link, + unlink, + children: publicChildren, + internalChildren, + }, + value + ) + ); }; return { diff --git a/packages/vant-use/src/useRelation/useParent.ts b/packages/vant-use/src/useRelation/useParent.ts index ac8ec53fa..e439926f3 100644 --- a/packages/vant-use/src/useRelation/useParent.ts +++ b/packages/vant-use/src/useRelation/useParent.ts @@ -20,7 +20,7 @@ export function useParent(key: string | symbol) { if (parent) { const instance = getCurrentInstance()!; - const { link, unlink, internalChildren, ...rest } = parent; + const { link, unlink, internalChildren } = parent; link(instance); onUnmounted(() => unlink(instance)); @@ -28,7 +28,7 @@ export function useParent(key: string | symbol) { const index = computed(() => internalChildren.indexOf(instance)); return { - parent: rest, + parent, index, }; } diff --git a/packages/vant-use/yarn.lock b/packages/vant-use/yarn.lock index 2aa5ee5e9..f78c48aa6 100644 --- a/packages/vant-use/yarn.lock +++ b/packages/vant-use/yarn.lock @@ -911,13 +911,6 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@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/runtime@^7.11.0", "@babel/runtime@^7.8.4": version "7.11.2" resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.11.2.tgz?cache=0&sync_timestamp=1596637803941&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"