From b7b354abd3d55089ac79ac9bbeee617a2516249b Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Tue, 21 Dec 2021 15:33:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(mp):=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=BD=BF=E7=94=A8=E6=8F=92=E6=A7=BD=E7=83=AD=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=EF=BC=8C=E4=B8=A2=E5=A4=B1=20genericComponen?= =?UTF-8?q?ts=20=E4=BF=A1=E6=81=AF=20question/136258?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-cli-shared/lib/cache.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/uni-cli-shared/lib/cache.js b/packages/uni-cli-shared/lib/cache.js index ef8e29694..cb666134a 100644 --- a/packages/uni-cli-shared/lib/cache.js +++ b/packages/uni-cli-shared/lib/cache.js @@ -82,11 +82,14 @@ function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Com const oldJsonStr = getJsonFile(name) if (oldJsonStr) { // update - if (usingComponents) { // merge usingComponents + if (usingComponents) { // merge usingComponents // 其实直接拿新的 merge 到旧的应该就行 const oldJsonObj = JSON.parse(oldJsonStr) - jsonObj.usingComponents = oldJsonObj.usingComponents || {} + jsonObj.usingComponents = oldJsonObj.usingComponents || {} jsonObj.usingAutoImportComponents = oldJsonObj.usingAutoImportComponents || {} + if(oldJsonObj.genericComponents) { + jsonObj.genericComponents = oldJsonObj.genericComponents + } if (oldJsonObj.usingGlobalComponents) { // 复制 global components(针对不支持全局 usingComponents 的平台) jsonObj.usingGlobalComponents = oldJsonObj.usingGlobalComponents } @@ -351,4 +354,4 @@ module.exports = { updateGenericComponents, getChangedJsonFileMap, getSpecialMethods -} +} -- GitLab