java - 类型错误 : Cannot read property 'initLazy' of undefined?

标签 java wildfly vaadin vaadin-flow

我是 Vaadin 开发的新手。尝试为 Wildfly 建立一个项目。 我将 Vaadin 14.1.16 与 Wildfly 18 和 Java 8 结合使用。 当我加载页面时,页面出现错误,如下所示。

(TypeError) : Cannot read property 'initLazy' of undefined

此外,textArea 不会出现在页面上。

注释标签位于右侧,而我预计位于选择组件下方。 我已经尝试在谷歌上找到与此问题相关的任何内容,但船上没有任何内容。

Vaadin 天才,你知道为什么以及我应该如何解决它吗?

@Route(value = "maintenance", layout = MainView.class)
@PageTitle("Maintenance Mode Selector")
public class MaintenanceView extends Div implements AfterNavigationObserver {

    @Inject
    private Maintenance maintenance;
    private ComboBox<MaintenanceMode> operationComboBox = new ComboBox<>(MaintenanceMode.NORMAL_OPERATION.getDescription());
    private Select<String> maintenanceSelector = new Select();
    private TextArea commentTextArea = new TextArea();
    private PasswordField passwordField = new PasswordField();
    private Button btnOperation = new Button("Set Operation Mode");

    public MaintenanceView() {
        setId("maintenance-view");

        operationComboBox.setItemLabelGenerator(MaintenanceMode::getDescription);
        operationComboBox.setItems(MaintenanceMode.values());

        maintenanceSelector.setItems("MAINTENANCE OPERATION", "NORMAL OPERATION");
        maintenanceSelector.getStyle().set("width", "40em");
        maintenanceSelector.setPlaceholder("CHOOSE AN OPERATION");

        commentTextArea.getStyle().set("minHeight", "200em");
        commentTextArea.setPlaceholder("Down time is expected to be 30 minute ...");
        commentTextArea.addThemeVariants(TextAreaVariant.LUMO_SMALL);

        btnOperation.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
        btnOperation.addClickListener(buttonClickEvent -> {
            maintenance.setMode("MAINTENANCE OPERATION".equals(maintenanceSelector.getValue()) ? "1" : "0");
            maintenance.setComment(commentTextArea.getValue());
        });

        SplitLayout splitLayout = new SplitLayout();
        splitLayout.setOrientation(SplitLayout.Orientation.HORIZONTAL);
        splitLayout.setSizeFull();

        createEditorLayout(splitLayout);

        add(splitLayout);
    }


    private void createEditorLayout(SplitLayout splitLayout) {
        FormLayout formLayout = new FormLayout();
        formLayout.setResponsiveSteps(
                new FormLayout.ResponsiveStep("40em",2, FormLayout.ResponsiveStep.LabelsPosition.TOP),
                new FormLayout.ResponsiveStep("40em",1, FormLayout.ResponsiveStep.LabelsPosition.TOP),
                new FormLayout.ResponsiveStep("40em",2, FormLayout.ResponsiveStep.LabelsPosition.TOP),
                new FormLayout.ResponsiveStep("40em",1, FormLayout.ResponsiveStep.LabelsPosition.TOP)
                );

        formLayout.addFormItem( operationComboBox, "Combobox Component:");
        formLayout.addFormItem( maintenanceSelector, "Select Component:");
        formLayout.addFormItem( commentTextArea, "Comments:");
        formLayout.addFormItem( passwordField, "Password:");
        formLayout.addFormItem( btnOperation,"");

        formLayout.setColspan(operationComboBox,2);
        formLayout.setColspan(maintenanceSelector,2);
        formLayout.setColspan(commentTextArea,2);
        formLayout.setColspan(passwordField,2);
        formLayout.setColspan(btnOperation,1);

        splitLayout.addToSecondary(formLayout);
    }

    @Override
    public void afterNavigation(AfterNavigationEvent afterNavigationEvent) {

    }
}   

我稍微改变了布局,但现在出现了这些错误。

(TypeError) : Cannot read property 'confirm' of undefined
(TypeError) : Cannot read property 'set' of undefined
(TypeError) : Cannot read property 'updateSize' of undefined

页面截图。 enter image description here

最佳答案

删除此行:

ui.getPage().executeJs("window.Vaadin.Flow.comboBoxConnector.initLazy($0);", getElement());

关于java - 类型错误 : Cannot read property 'initLazy' of undefined?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60093977/

相关文章:

java - 使用 Netbeans 在远程服务器上热部署

java - Hibernate 模型对象作为 VO 对象

java - 如果配置了 "max-backup-index"属性,Wildfly如何知道需要删除多个文件?

java - 支持 Servlet 3.0 的最低 Wildfly 版本

java - Vaadin 和 Spring Security : "/VAADIN/**" route

kotlin - 查找表中的所有行,即使您必须向下滚动表

java - 在 REST 服务中实现方法 OPTIONS 的最佳方式

java - 如何使用java在mysql中插入时间

logging - 如何配置 WildFly 8.2.0 日志记录以仅显示调试级别的应用程序

java - 我的 Vaadin 登录页面不会触发克罗恩的 "Save Password"功能