如果路由是动态的,则无法使用惯性-link 导航页面
Unable to navigate page with inertia-link if route is dynamic
在 laravel.
中使用动态路由时,单击惯性-link 时,我找不到导航到新页面的方法
路线:
This two is not added together in the code. I tried both way to tested so i put both here
Route::get('/{clothesCategory}', 'ClothesController@getCalsas'); // this doesnt work
Route::get('/NotDynamic, 'ClothesController@getCalsas'); // this work
Html:
<inertia-link href="/NotDynamic">Not Working</inertia-link> //this only works with NotDynamic route
<a href="/NotDynamic">Working</a> // this works with both routes
为什么会这样我不明白背后的原因?还有我怎样才能让惯性-link与动态路线一起工作?
找到如何使用 :headers
执行此操作
<inertia-link href="/endpoint" :headers="{ clothesCategory: endpoint}">end point</inertia-link>
您可以简单地按照这个例子:
<inertia-link :href="'/' + data.slug">Go To</inertia-link>
在“href”之前使用“:”(冒号)。然后您可以将动态值插入 link.
在 laravel.
中使用动态路由时,单击惯性-link 时,我找不到导航到新页面的方法路线:
This two is not added together in the code. I tried both way to tested so i put both here
Route::get('/{clothesCategory}', 'ClothesController@getCalsas'); // this doesnt work
Route::get('/NotDynamic, 'ClothesController@getCalsas'); // this work
Html:
<inertia-link href="/NotDynamic">Not Working</inertia-link> //this only works with NotDynamic route
<a href="/NotDynamic">Working</a> // this works with both routes
为什么会这样我不明白背后的原因?还有我怎样才能让惯性-link与动态路线一起工作?
找到如何使用 :headers
<inertia-link href="/endpoint" :headers="{ clothesCategory: endpoint}">end point</inertia-link>
您可以简单地按照这个例子:
<inertia-link :href="'/' + data.slug">Go To</inertia-link>
在“href”之前使用“:”(冒号)。然后您可以将动态值插入 link.