【发布时间】:2021-09-10 08:17:34
【问题描述】:
当从控制器重定向时,在存储(POST http 请求)之类的操作之后:
class EntityController extends Controller
{
public function store(Request $request): RedirectResponse
{
....
return redirect()->route('entities.list')->withFragment('manage');
}
}
如何在 URL 中保留哈希?
如上例,返回页面https://example.com/entities#manage
我怀疑 Inertia 在这种情况下正在做一些魔术,因为我无法将哈希值保留在 URL 中。从它在 Laravel 文档中所写的内容来看,它似乎应该是可能的。
相关技术栈:
- Laravel 框架:8.42.1
- inertiajs/inertia-laravel:v0.3.6
参考资料:
【问题讨论】: