Eze*_*iel 9 dart flutter flutter-web
我需要更改此网页的内容
并将 url 从“localhost:49318/#/home/inicio”更改为“localhost:49318/#/home/other”。
所有这一切都无需使用导航器。
在移动应用程序中,我会更改显示为设置状态的小部件,但在网页上执行此操作不会更改 url。
小智 21
我使用 Fluro(一个包)来控制我的路由,但最终我需要更改 URL 而无需重定向。
解决方案非常简单
导入这个:
import 'dart:html' as html;
Run Code Online (Sandbox Code Playgroud)
然后在您的代码中,使用它来更改 URL,而不影响当前页面
html.window.history.pushState(null, 'home', '#/home/other');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1321 次 |
| 最近记录: |