Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Crazysanlang opened this issue Jun 7, 2023 · 4 comments

Comments

@Crazysanlang
Copy link

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

@Crazysanlang
Copy link
Author

该问题已解决

@Jason-linjiayu
Copy link

怎么解决的呢

@yiludege
Copy link
Collaborator

yiludege commented Oct 10, 2023

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

@ZGH0717
Copy link

ZGH0717 commented Oct 10, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants