wujie icon indicating copy to clipboard operation
wujie copied to clipboard

主应用element ui ,子应用element-plus ,接入后子应用的样式问题

Open David-mahu666 opened this issue 3 years ago • 4 comments

主应用element ui ,子应用element-plus ,接入后子应用的 样式变量 使用主应用:root的样式,导致颜色变量丢失,有遇到的小伙伴们可以一块讨论下, 怎么解决 image

David-mahu666 avatar Jun 07 '23 09:06 David-mahu666

该问题已解决

David-mahu666 avatar Jun 08 '23 06:06 David-mahu666

怎么解决的呢

lin-jiayu avatar Jul 12 '23 03:07 lin-jiayu

这个地方子应用样式应该是不会采用主应用 root 的,因为子应用的变量会以host挂载到子应用容器上,优先级更高啊, wujie getPatchStyleElements 函数处理了这个事情

yiludege avatar Oct 10 '23 02:10 yiludege

在主应用中通过设置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;
 }

ZGH0717 avatar Oct 10 '23 03:10 ZGH0717