徽章样式似乎不适用于 Vaadin 23

发布于 2025-01-19 20:38:34 字数 396 浏览 0 评论 0原文

从Vaadin 22移至23,徽章样式似乎无法正常工作。

加载资源几乎相同:

@JsModule("@vaadin/vaadin-lumo-styles/badge.js")
@CssImport(include = "lumo-badge", value = "./styles/empty.css")
public class SomeClass...
...
envBadge.getElement().getThemeList().add("badge success");

@vaadin/vaadin-lumo-styles/badge.js确实存在于node_modules dir中...

有什么想法吗?根据文档,似乎是正确的,就像版本22中...

谢谢

moved from Vaadin 22 to 23 and badge styling seems not be working as expected.

Loading resources pretty much the same way:

@JsModule("@vaadin/vaadin-lumo-styles/badge.js")
@CssImport(include = "lumo-badge", value = "./styles/empty.css")
public class SomeClass...
...
envBadge.getElement().getThemeList().add("badge success");

@vaadin/vaadin-lumo-styles/badge.js do exists in node_modules dir...

Any idea? According to documentation, it seems right, as in version 22...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我有同样的问题。 @JsModule("@vaadin/vaadin-lumo-styles/badge.js")
@CssImport(include = "lumo-badge", value = "./styles/empty.css") 注释在最新的 22 版本中工作正常,但升级到 23 版本后,徽章样式停止工作。
但我设法解决问题。我从 Badge 类中删除了这些注释,创建了包含内容的 frontend/themes/common-theme/theme.json 文件

{
  "lumoImports": ["badge"]
}

,最后添加了 @Theme("common-theme") 进入我的应用程序配置器

@Theme("common-theme")
public class AppConfigurator implements AppShellConfigurator {
}

I had same problem. @JsModule("@vaadin/vaadin-lumo-styles/badge.js") and
@CssImport(include = "lumo-badge", value = "./styles/empty.css") annotations worked fine with latest 22 version but after upgrading to 23 version, badge styles stop working.
But I manage to resolve issue. I removed those annotations from my Badge class, created frontend/themes/common-theme/theme.json file with content

{
  "lumoImports": ["badge"]
}

and finally I added @Theme("common-theme") into my app configurator

@Theme("common-theme")
public class AppConfigurator implements AppShellConfigurator {
}
亚希 2025-01-26 20:38:34

我正在使用 Vaadin 14.10.1,当我在应用程序中使用徽章时,我遇到了同样的问题。我能够通过从 GitHub (https://github.com/vaadin/vaadin-lumo-styles/blob/v1.6.1/badge.html)并在主类中添加以下注释。

@JsModule("@vaadin/vaadin-lumo-styles/badge.js")
@CssImport(include = "lumo-badge", value = "./styles/vaadin-badge.css")

I am using Vaadin 14.10.1 and I was facing the same issue when I used a badge in my application. I was able to resolve this issue by creating a CSS file /frontend/styles/vaadin-badge.css from the style defined in GitHub (https://github.com/vaadin/vaadin-lumo-styles/blob/v1.6.1/badge.html) and adding the following annotation in the main class.

@JsModule("@vaadin/vaadin-lumo-styles/badge.js")
@CssImport(include = "lumo-badge", value = "./styles/vaadin-badge.css")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文