gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 01:05:31 24 4
gpt4 key购买 nike

我是 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/

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