Vaadin 设置背景不起作用
Vaadin setting background not working
所以我有点困惑为什么设置背景图片不起作用。我可以使用其他 SCSS 方法(如 .top 等)来设置颜色等,但是当涉及到通过 SCSS 拉取图像时,应用程序会出现错误。
我的主题:
@import "../valo/valo.scss";
@import "../valo/fonts/fonts.scss";
@import "../valo/styles.css";
@mixin mytheme {
@include valo-components;
@include valo-common;
@include vaadin-icons;
@include valo;
background-color: lawngreen;
}
styles.scss:
@import "mytheme.scss";
@import "addons.scss";
@import "../valo/styles.css";
// This file prefixes all rules with the theme name to avoid causing conflicts with other themes.
// The actual styles should be defined in mytheme.scss
.mytheme {
@include addons;
@include valo;
@include mytheme;
.backgroundImage{
background: url("img/background.jpg ") ;
}
.v-view {
}}
应用程序 运行 处于生产模式,图像文件的路径如下:
D:\Programming\app\src\main\WebContent\VAADIN\themes\mytheme\img\background.jpg
错误:
INFO 16672 --- [nio-8080-exec-9] com.vaadin.server.VaadinServlet :
Requested resource
[/VAADIN/themes/mytheme/VAADIN/themes/mytheme/img/background.jpg] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
有人知道这里发生了什么吗?
感谢您提供错误文本。该错误文本显示了问题,即 Vaadin 正在寻找图像:
/VAADIN/themes/mytheme /VAADIN/themes/mytheme/img/background.jpg
注意路径中重复的根部分。至于为什么会发生这种情况我不能说,但我会检查你的配置(我知道,随机明显的答案)。也许试试这个:
url("/VAADIN/themes/mytheme/img/background.jpg");
所以我有点困惑为什么设置背景图片不起作用。我可以使用其他 SCSS 方法(如 .top 等)来设置颜色等,但是当涉及到通过 SCSS 拉取图像时,应用程序会出现错误。
我的主题:
@import "../valo/valo.scss";
@import "../valo/fonts/fonts.scss";
@import "../valo/styles.css";
@mixin mytheme {
@include valo-components;
@include valo-common;
@include vaadin-icons;
@include valo;
background-color: lawngreen;
}
styles.scss:
@import "mytheme.scss";
@import "addons.scss";
@import "../valo/styles.css";
// This file prefixes all rules with the theme name to avoid causing conflicts with other themes.
// The actual styles should be defined in mytheme.scss
.mytheme {
@include addons;
@include valo;
@include mytheme;
.backgroundImage{
background: url("img/background.jpg ") ;
}
.v-view {
}}
应用程序 运行 处于生产模式,图像文件的路径如下:
D:\Programming\app\src\main\WebContent\VAADIN\themes\mytheme\img\background.jpg
错误:
INFO 16672 --- [nio-8080-exec-9] com.vaadin.server.VaadinServlet :
Requested resource
[/VAADIN/themes/mytheme/VAADIN/themes/mytheme/img/background.jpg] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
有人知道这里发生了什么吗?
感谢您提供错误文本。该错误文本显示了问题,即 Vaadin 正在寻找图像:
/VAADIN/themes/mytheme /VAADIN/themes/mytheme/img/background.jpg
注意路径中重复的根部分。至于为什么会发生这种情况我不能说,但我会检查你的配置(我知道,随机明显的答案)。也许试试这个:
url("/VAADIN/themes/mytheme/img/background.jpg");