我们使用GXT和GWT,每个基础构件都有一个CSS文件。 GWT有一个全球CSS风格的最佳方式是什么?GWT - 设置全局CSS样式的最佳方法
例如
global.css
.backgroundBorder {
border-style: solid;
border-width: 2px;
border-radius: 3px;
}
myWidget.css
@backgroundBorder
我们使用GXT和GWT,每个基础构件都有一个CSS文件。 GWT有一个全球CSS风格的最佳方式是什么?GWT - 设置全局CSS样式的最佳方法
例如
global.css
.backgroundBorder {
border-style: solid;
border-width: 2px;
border-radius: 3px;
}
myWidget.css
@backgroundBorder
我同意。另外我会在上面的AppClientBundle中包含一个接口。
public interface AppClientBundle extends ClientBundle {
public static final AppClientBundle INSTANCE = GWT.create(AppClientBundle.class);
@Source({ "css/template/global.css" })
MyStyle css();
public interface MyStyle extends CssResource {
String backgroundBorder();
}
}
这给你的风格你的widget这样的可能性:
Widget.setStylePrimaryName(AppClientBundle.INSTANCE.css().backgroundBorder());
希望帮助...
您可以使用ClientBundles和CssResources。
https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle#CssResource
在您的入口点可以设置全局CSS。 类似的是:
YourStyle.getTheme().getAppClientBundle().getGlobalCss().ensureInjected();
你clientbundle也能像类似:
public interface AppClientBundle extends ClientBundle {
@Source({ "css/template/global.css" })
CssResource getGlobalCss();
}
从我的experiance,这是最好的方式。
这似乎是最好的办法。我并不清楚我们已经在使用ClientBundle和CssResources。 – Kenoyer130