需求:父组件样式影响子组件,但子组件样式不影响父组件。
子组件中,定义如下:
Component({
options: {
styleIsolation: 'isolated',
// 或者
addGlobalClass: true,
}
})
或者在页面的 json 文件中配置如下信息:
{
"styleIsolation": "isolated"
}
需求:父组件样式影响子组件,但子组件样式不影响父组件。
子组件中,定义如下:
Component({
options: {
styleIsolation: 'isolated',
// 或者
addGlobalClass: true,
}
})
或者在页面的 json 文件中配置如下信息:
{
"styleIsolation": "isolated"
}