看起来,以前可以通过Page.getCurrent().getLocation();获得当前位置url (浏览器地址栏中的url)。
如何在Vaadin23中获取当前应用程序url?用com.vaadin.flow.component.UI对象可以吗?
我试过了
UI.getCurrent().getPage().fetchCurrentURL(currentUrl -> {
System.out.println("!!!: " + currentUrl);
});但是这个回调从未被调用..。我做错了什么?
发布于 2022-07-27 13:46:50
我总是使用JavaScript:
UI.getCurrent().getPage()
.executeJs("return window.location.href")
.then(jsonValue -> System.out.println(jsonValue.asString()));但
UI.getCurrent().getPage().fetchCurrentURL(System.out::println);在内部也是如此。
https://stackoverflow.com/questions/73137890
复制相似问题