为什么我的Vuetify应用将其变成Web组件时会丢失其样式?
我正在尝试使用Vuetify构建Web组件。但是,当我将该Web组件嵌入容器中时,Shadow-Dom失去了其样式,结果只是一堆暗淡的灰色按钮。
我创建了一个简单的示例,说明了我在说什么:
I am trying to build a web component using vuetify. However, when I embed that web component in a container, the shadow-dom loses its styling and the result is just a bunch of dull grey buttons.
I've created a simple example of what I am talking about at:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您使用其任何组件时,将CSS样式添加到文档顶部。因此,当您的组件被包裹在Shadow dom内的自定义元素中时,则在Shadow dom中无法访问
veutify
提供的所有样式。您可以尝试两种选项:
Veutify add the CSS styling to the top of the document when you use any of its components. So when your component gets wrapped inside a custom element within Shadow DOM, then all the styling provided by
Veutify
is not accessible inside shadow DOM.There are two options you can try:
这似乎适用于Vuetify 3: nofollow noreferrer“> htttps://blog..panda-panda-studio.cn/vue_comcomcom_webp_comcpond/ >
This seems to work for vuetify 3: https://blog.panda-studio.cn/vue_web_component_webpack_compiler