html - 如何单击按钮并使用按钮所在项目的项目 ID 将其发送到另一个视图。Laravel - vue.js - 惯性 vue
问题描述
我正在制作一个包含讨论论坛并且用户必须回答它们的仪表板,我希望它向具有讨论论坛信息的卡片添加一个按钮,并打开用户可以添加评论的视图。但是为了能够回答正确的论坛,我需要发送用户点击的论坛 ID。
我已经尝试过使用inertia-link
@click 按钮。这是我的路线
Route::resource('comments', 'ReplyController', ['except' => ['index']]);
Route::get('comments/{id}', 'ReplyController@index');
在控制器中
public function index($id)
{
$forum = DiscussionForum::where('id', $id)
->with('comment', 'user')->first();
$comment = ForumReply::with('discussionForum', 'user')
->where('discussion_forum_id', $forum->id)
->orderByDesc('comment_time')->get();
return Inertia::render('Forum/Comment.vue', [
'forum' => $forum,
'comments' => $comment
]);
}
这是我尝试过的,这会将我带到页面,但它是空白的,不应该是
<a class="el-button el-button--warning"
:href="'comments/' + f.id"> Contestar </a>
这样做的正确方法是什么?
解决方案
推荐阅读
- c# - 有没有办法从 c# 将一组 SafeHandles 发送到本机函数?
- google-bigquery - 根据 id 列的条目数查询以将表中的数据聚合到另一个表中
- php - 图像和 css 未使用 PHP 在本地 wamp 服务器上加载
- reactjs - 预期 ReactBoostrap 声明或声明。TS1128
- c++ - C++ lock_guard 与 mutex.lock()
- c# - DocuSign Connect 如何配置信封以接收身份验证失败通知?
- angular - 为什么这个 ngx-leaflet 参数不能正常工作?
- kivy - 无法在 kivyMD 中使用全局变量作为 MDLabel 的文本(初学者)
- typescript - 如何将 +1 添加到正则表达式捕获?
- vector-graphics - 支持可变厚度行程