提交 c5eb0193 编写于 作者: D DCloud_LXH

fix(mp-baidu): app.json usingComponents path question/138662

上级 91a65496
......@@ -40,6 +40,24 @@ export function mergeMiniProgramAppJson(
})
}
function normalizeUsingComponentsPath(
usingComponents: PageWindowOptions['usingComponents'],
platform: UniApp.PLATFORM
) {
if (platform === 'mp-baidu') {
const flag = './'
const _usingComponents: PageWindowOptions['usingComponents'] = {}
for (const key in usingComponents) {
const componentPath = usingComponents[key]
_usingComponents[key] = componentPath.startsWith(flag)
? componentPath.replace(flag, '/')
: componentPath
}
return _usingComponents
}
return usingComponents
}
function parsePagesJson(
jsonStr: string,
platform: UniApp.PLATFORM,
......@@ -135,7 +153,10 @@ function parsePagesJson(
const { usingComponents } = windowOptions as PageWindowOptions
if (usingComponents) {
delete (windowOptions as PageWindowOptions).usingComponents
appJson.usingComponents = usingComponents
appJson.usingComponents = normalizeUsingComponentsPath(
usingComponents,
platform
)
} else {
delete appJson.usingComponents
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册