<dependency> <groupId>com.vaadin.external.gentyref</groupId> <artifactId>gentyref</artifactId> <version>1.2.0</version> </dependency> import com.vaadin.flow.component.Component; import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.dependency.JsModule; import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.NativeButton; import com.vaadin.flow.router.Route; import com.vaadin.flow.router.PageTitle; @Route(value = "example", layout = MainLayout.class) @PageTitle("Example") @Tag("example-view") @JsModule("./src/example-view.js") public class ExampleView extends Div { public ExampleView() { A11yKeyBinder<ExampleView> a11yKeyBinder = new A11yKeyBinder<>(this); a11yKeyBinder.withDefaultOperation(Key.SPACE, this::performAction); button.addClickListener(event -> performAction()); add(button); } private void performAction() { // ... } }


上一篇:
下一篇:
切换中文