Skip to content

Commit

Permalink
fix(mp-baidu): usingSwanComponents merge to wxComponents (question/15…
Browse files Browse the repository at this point in the history
…5281)
  • Loading branch information
zhetengbiji committed Oct 14, 2022
1 parent 723bc49 commit 848248b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/webpack-uni-pages-loader/lib/index-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ const {

// 将开发者手动设置的 usingComponents 调整名称,方便与自动解析到的 usingComponents 做最后合并
function renameUsingComponents (jsonObj) {
if (jsonObj.usingComponents) {
jsonObj.customUsingComponents = jsonObj.usingComponents
if (jsonObj.usingComponents || jsonObj.usingSwanComponents) {
// 暂定 usingComponents 优先级高于 usingSwanComponents
jsonObj.customUsingComponents = Object.assign({}, jsonObj.usingSwanComponents, jsonObj.usingComponents)
delete jsonObj.usingComponents
delete jsonObj.usingSwanComponents
}
return jsonObj
}
Expand Down
6 changes: 4 additions & 2 deletions packages/webpack-uni-pages-loader/lib/platforms/mp.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ function deepCopy (name, value, json) {
const pagesJson2AppJson = {
globalStyle: function (name, value, json) {
json.window = parseStyle(value)
if (json.window.usingComponents) {
json.usingComponents = json.window.usingComponents
if (json.window.usingComponents || json.window.usingSwanComponents) {
// 暂定 usingComponents 优先级高于 usingSwanComponents
json.usingComponents = Object.assign({}, json.window.usingSwanComponents, json.window.usingComponents)
delete json.window.usingComponents
delete json.window.usingSwanComponents
} else {
json.usingComponents = {}
}
Expand Down

0 comments on commit 848248b

Please sign in to comment.