Skip to content

Commit

Permalink
fix(mp-alipay): styleIsolation: 'apply-shared'
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Mar 10, 2023
1 parent 8622d73 commit e790289
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/uni-cli-shared/lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ const supportGlobalUsingComponents = process.env.UNI_PLATFORM === 'mp-weixin' ||
function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Component') {
if (type === 'Component') {
jsonObj.component = true
}
if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-alipay') {
jsonObj.styleIsolation = 'apply-shared'
}
} else if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-baidu') {
jsonObj.component = true
}
Expand Down Expand Up @@ -162,6 +164,9 @@ function updateUsingComponents (name, usingComponents, type) {
const jsonObj = JSON.parse(oldJsonStr)
if (type === 'Component') {
jsonObj.component = true
if (process.env.UNI_PLATFORM === 'mp-alipay') {
jsonObj.styleIsolation = 'apply-shared'
}
} else if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-baidu') {
jsonObj.component = true
Expand All @@ -179,6 +184,9 @@ function updateUsingComponents (name, usingComponents, type) {
}
if (type === 'Component') {
jsonObj.component = true
if (process.env.UNI_PLATFORM === 'mp-alipay') {
jsonObj.styleIsolation = 'apply-shared'
}
} else if (type === 'Page') {
if (process.env.UNI_PLATFORM === 'mp-baidu') {
jsonObj.component = true
Expand Down Expand Up @@ -322,7 +330,7 @@ module.exports = {
if (!fs.existsSync(filepath)) {
try {
clearCache()
} catch (e) {}
} catch (e) { }
return
}
const pagesJsonPath = path.resolve(process.env.UNI_INPUT_DIR, 'pages.json')
Expand All @@ -331,7 +339,7 @@ module.exports = {
if (jsonCache.mtimeMs !== mtimeMs) {
try {
clearCache()
} catch (e) {}
} catch (e) { }
return
}
jsonFileMap = new Map(jsonCache.files)
Expand Down Expand Up @@ -366,4 +374,4 @@ module.exports = {
getChangedJsonFileMap,
getSpecialMethods,
supportGlobalUsingComponents
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function parseBaseComponent (vueComponentOptions, {

const options = {
multipleSlots: true,
// styleIsolation: 'apply-shared',
addGlobalClass: true,
...(vueOptions.options || {})
}
Expand Down

2 comments on commit e790289

@Soonze
Copy link

@Soonze Soonze commented on e790289 Jun 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhetengbiji 此项提交导致支付宝小程序的组件默认为styleIsolation: 'apply-shared'模式,与支付宝官方文档不符,与之前版本升级后效果不符。且mp-alipay下无法通过vueOptions.styleIsolation修改此模式。

@zhetengbiji
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhetengbiji 此项提交导致支付宝小程序的组件默认为styleIsolation: 'apply-shared'模式,与支付宝官方文档不符,与之前版本升级后效果不符。且mp-alipay下无法通过vueOptions.styleIsolation修改此模式。

此项是接受其他开发者建议后,于3.7.12.20230331-alpha版添加,2个月内并无开发者反馈相关问题,后发布到3.8.3.20230526版,均有相关更新日志。因支付宝的设计问题暂时无法通过vueOptions.styleIsolation进行配置。如遇问题可以具体提出,会考虑处理方案。

Please sign in to comment.