gpt4 book ai didi

java - 部署后未应用覆盖的 GWT CSS 样式

转载 作者:太空宇宙 更新时间:2023-11-04 02:21:00 24 4
gpt4 key购买 nike

我目前正在使用 GWT 开发 Web 应用程序。对于特定 View ,我必须使用 GWT DataGrid 小部件。由于我无法为其应用 CSS 样式,因此我决定通过在检查页面时获取它们的名称来重新插入应用于其标题和其他一些部分的特定样式来覆盖默认样式。

这是我放在自定义 CSS 样式表中的内容:

.com-google-gwt-user-cellview-client-DataGrid-Style-dataGridEvenRow {
background-color: #444444 !important;
}
.com-google-gwt-user-cellview-client-DataGrid-Style-dataGridEvenRowCell {
border: 2px solid #4d4d4d !important;
}
.com-google-gwt-user-cellview-client-DataGrid-Style-dataGridOddRowCell {
border: 2px solid #4d4d4d !important;
}
.com-google-gwt-user-cellview-client-DataGrid-Style-dataGridOddRow {
background-color: #4d4d4d !important;
}
.com-google-gwt-user-cellview-client-DataGrid-Style-dataGridHeader {
color: #aaaaaa !important;
text-shadow: #4d4d4d 0px 0px 0 !important;
padding: 0px !important;
}
.com-google-gwt-resources-client-CommonResources-InlineBlockStyle-inlineBlock {
background-color: #4d4d4d !important;
}

我知道“!important”应该是最后的手段,但值得注意的是我已经覆盖了默认样式,当我在“ super 开发模式”下运行我的应用程序时它工作得很好。

当我部署 .war 文件时出现问题。我的样式表中的每个自定义样式都被正确应用,除了我已经覆盖的那些。当我加载页面时,Chrome 控制台没有显示任何错误,而当我检查页面时,这些样式似乎丢失了。

有谁知道这里出了什么问题以及如何解决?请注意,我不太熟悉 Web 开发,这是我第一次编写 Web 应用程序。

最佳答案

你的问题是样式在 dev mod 中没有被混淆,所以它们看起来像 .com-google-gwt-user-cellview-client-DataGrid-Style-dataGridEvenRow .当您编译和部署 war 文件时,所有文件通常都会被混淆并且看起来像 .GKY5KDJCI。 .所以在生产中你不会覆盖样式。
您可以使用以下属性更改 gwt.xml 文件中的混淆级别:
<set-configuration-property name="CssResource.style" value="pretty"/>其他可用选项是:debug、stable、stable-shorttype、stable-notype。默认是混淆的。
无论如何,您应该遵循 Youssef Lahoud 建议的方法并为您的数据网格提供自定义 css 资源。

关于java - 部署后未应用覆盖的 GWT CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38109738/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com