参考上面

- 发布:2025-08-05 20:20
- 更新:2025-08-05 20:34
- 阅读:85
产品分类: uniapp/小程序/阿里
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 11
HBuilderX类型: 正式
HBuilderX版本号: 4.76
第三方开发者工具版本号: 最新
基础库版本号: 最新
项目创建方式: HBuilderX
操作步骤:
预期结果:
一致
一致
实际结果:
不一致
不一致
bug描述:
测试组件代码
<template>
<view>123</view>
</template>
<script setup>
defineOptions({
styleIsolation: 'shared'
})
</script>
产物代码
// xxx.js
"use strict";
const _sfc_main = /* @__PURE__ */ Object.assign({
styleIsolation: "shared"
}, {
__name: "test",
setup(__props) {
return (_ctx, _cache) => {
return {};
};
}
});
my.createComponent(_sfc_main);
// xxx.json
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}
两个 styleIsolation 不一致
z***@163.com
这个问题一直存在的,微信小程序也一样,styleIsolation 要写在 defineComponent里面才会生效。
2025-08-07 19:49
DCloud_UNI_JBB
回复 z***@163.com: 会一起修复掉
2025-08-07 20:53