laravel+reactjs:部署中无法点击链接(使用vercel)

问题描述 投票:0回答:1

我发现了问题,但找不到解决方案。 当我在链接中使用这样的 href 时:{route('route.index')} 它不起作用(无法单击) 当我在链接中使用这样的 href 时:“/login”它正在工作(可以单击)

就像下面的代码

<Link href={route('routines.index')}>Back</Link>

<Link href="/login" as="button">Login</Link>

this example in part of my code

link must to be

reactjs laravel routes deployment vercel
1个回答
0
投票

我不知道这是否只是您的问题代码片段中的错误,但您应该在刀片文件中使用双大括号,因此将

{route('routines.index')}
更改为
{{ route('routines.index') }}
- 如果您的项目中也存在此错误,这肯定会导致网址损坏。

使用单大括号将导致

https://localhost:8080/admin/%7Broute('backend.users.list')%7D
但使用 double 会导致:
https://localhost:8080/admin/app-users

© www.soinside.com 2019 - 2024. All rights reserved.