Css 即时导入

Lis*_*art 1 java vaadin vaadin14

有没有办法在 Vaadin14 中即时导入 css 样式表?我@CssImport("./views/main/main-view.css")在班级的顶端使用,并且

Button lumoBtn = new Button("Lumo", click -> {
            UI ui = this.getUI().get();
            ThemeList themeList = ui.getCurrent().getElement().getThemeList(); //
            if (themeList.contains(Lumo.DARK)) { //
                themeList.remove(Lumo.DARK);
            } else {
                themeList.add(Lumo.DARK);
            }
        });
Run Code Online (Sandbox Code Playgroud)

即时在黑暗和光明之间切换。但是现在我也希望能够在 Material、Lumo 和其他 AbstracTheme 之间动态切换。

oll*_*nen 5

您无法在运行时在主题之间切换,这是一个缺失的功能:https : //github.com/vaadin/flow/issues/5163