java - VaadinFlow 中的样式网格
问题描述
我尝试通过 shared-styles.html (webapp/frontend/styles) 更改 Vaadin Flow Grid 标题的背景颜色:
<custom-style>
<style>
<dom-module id="my-grid" theme-for="vaadin-grid">
<template>
<style>
[part~="header-cell"] {
background-color: blue;
}
</style>
</template>
</dom-module>
</style>
</custom-style>
对应于https://github.com/vaadin/vaadin-themable-mixin/wiki/3.-Stylable-Shadow-Parts和https://vaadin.com/components/vaadin-grid/html-api/elements/Vaadin .GridElement这应该可以工作 - 但它没有......
怎么了?
解决方案
<dom-module>
不应该在or<style>
标记内<custom-style>
,而是在它旁边。另外,背景颜色好像默认会被覆盖,所以你可以尝试添加!important
后进行测试。对我来说,设置th[part~="header-cell"]
似乎足够具体,不会被覆盖。
<custom-style>
<style>
</style>
</custom-style>
<dom-module id="my-grid" theme-for="vaadin-grid">
<template>
<style>
th[part~="header-cell"] {
background-color: darkorange;
}
</style>
</template>
</dom-module>
推荐阅读
- python - 用户警告:`ResNet50(include_top=False)` 的输出形状自 Keras 2.2.0 起已更改
- php - 仅以 laravel 中 hasMany 关系中的最新记录为条件
- html - 为什么这个动画不播放?
- docker - 面临 ssh 到 docker 容器的问题
- xcode - 升级到 Xcode 11.4.1、VS for Mac 8.5.4 和 Xamarin.iOS 13.16 后无法创建 IPA 存档
- reactjs - 为几个视频反应背景视频循环
- python - 如果包含单个 NaN 并合并列,则将整个组设置为 NaN
- php - PHP:表单验证“上传许多文件”
- django - 如何获取最后 X 小时的对象?
- c# - 找不到实体类型“赞助商”的种子身份