Vaadin 24.x生产环境中custom-field标签不显示问题求助
Vaadin 24.x Flow生产环境下Custom Field标签缺失问题
在基于Spring Boot的Vaadin 24.x Flow项目中,开发环境下FormLayout内的vaadin-custom-field标签显示正常,但部署到Ubuntu生产服务器后,这些custom-field的<label>标签缺失,同一FormLayout内的其他字段标签显示正常。
视图中的FormLayout代码
<vaadin-form-layout id="feed-overview" class="osiris-card orisis-card-form"> <vaadin-text-field colspan=1 id="network-field" label="Network" theme="readonly" readonly></vaadin-text-field> <vaadin-custom-field colspan=1 label="Address" has-label><address-link id="address-field"></address-link></vaadin-custom-field> <vaadin-custom-field colspan=1 label="Maintainer" has-label><address-link id="creator-field"></address-link></vaadin-custom-field> <vaadin-button colspan=1 label="Body" id="source-button" theme="primary contrast">View in Studio</vaadin-button> <vaadin-big-decimal-field colspan=1 class="important-text" id="security-field" label="Security Sum" theme="readonly" readonly></vaadin-big-decimal-field> </vaadin-form-layout>
自定义元素address-link代码
import {LitElement, css, html} from 'lit'; import {customElement, property} from 'lit-element'; import { applyTheme } from 'Frontend/generated/theme'; @customElement('address-link') export class AddressLink extends LitElement { protected override createRenderRoot() { const root = super.createRenderRoot(); applyTheme(root); return root; } render() { return html`<vaadin-horizontal-layout clase="vaadin-field-container" part="address-layout" theme="spacing-s" style="width: 100%;"> <a href="${this.explorerLink}" part="scan-link" class="explorer-link" target="_blank" rel="noopener noreferrer"> ${this.shortName} </a> <vaadin-button class="copy" part="copy-button" theme="icon tertiary-inline" @click="${this.copyToClipboard}"> <vaadin-icon class="copy-icon" icon-class="fa fa-copy"></vaadin-icon> <vaadin-tooltip slot="tooltip" text="Click to copy"></vaadin-tooltip> </vaadin-button> </vaadin-horizontal-layout>`; } }
已尝试的解决动作
- 将custom-field嵌入address-link组件(怀疑ShadowDom问题),无效
- 确认未使用影响标签显示的样式
- 排查过缓存相关设置,生产环境下标签仍不显示
环境信息
- Vaadin版本:24.1.x(已升级到24.2,问题未解决)
- Spring Boot版本:3.1.1
- 开发环境:Windows
- 生产服务器:Ubuntu 20
- 部署方式:bootJar打包部署
内容的提问来源于stack exchange,提问作者Dima Yankin
相关产品推荐
相关产品推荐

