wujie
wujie copied to clipboard
主应用element ui ,子应用element-plus ,接入后子应用的样式问题
主应用element ui ,子应用element-plus ,接入后子应用的 样式变量 使用主应用:root的样式,导致颜色变量丢失,有遇到的小伙伴们可以一块讨论下, 怎么解决
该问题已解决
怎么解决的呢
这个地方子应用样式应该是不会采用主应用 root 的,因为子应用的变量会以host挂载到子应用容器上,优先级更高啊, wujie getPatchStyleElements 函数处理了这个事情
在主应用中通过设置plugins的cssLoader解决了 #445
cssLoader: (code) => {
const rootStyleReg = /:root/g;
const hostStyleReg = /:host/g;
let newCode = code;
newCode = newCode.replace(rootStyleReg, ":host").replace(hostStyleReg, ":host html");
return newCode;
}