我的laravel/Vue应用程序中有以下组件。
当用户单击此按钮时,我希望将它们发送到privacy blade。(sample.site/privacy-policy)
<template lang="">
<div class="verbatimGameLayout__footer">
<FeedbackButton label="Vie privée" :onClick="goToFeedback" />
<SaveButton label="sauvgarder" />
</div>
</template>
export default {
components: {
FeedbackButton
},
methods: {
goToFeedback() {
window.location = "/privacy-policy";
}
}
};我在web.php中的路线如下,
Route::get('/privacy-policy', 'SecurityImplementationController@privacy');当我尝试访问URL时,它一直给我一个404错误...
下面是与上述问题相关的控制器(SecurityImplementationController.php)方法
public function privacy() {
return view('privacy');
}发布于 2021-09-01 07:06:42
为什么不清理您的路径缓存并检查
php artisan route:clear
php artisan route:cache发布于 2021-09-01 07:13:38
我建议您使用vue-router来执行这样的操作。
使用vue-router,您可以轻松地设置如下路由:
const routes = [
{ path: '/foo', component: Foo },
{ path: '/bar', component: Bar }
]然后,您可以像这样调用路由:
this.$router.push('/bar')有关更多信息,请参阅文档:Vue Router | Getting Started
https://stackoverflow.com/questions/69008257
复制相似问题