我有一个编辑页面:http://localhost/smp/post/12

API路由:
Route::get('package', [ProductController::class, 'update']);在ProductController.php中
public function update(Request $request) {
dd($request); //
}在product.vue中
axios
.post("/promotion-platform/api/images/upload",{ 'id' : this.id })
.then((res) => {
console.log(res.data);
})我把name盒从“iPhone13”改为“iPhone12”。当我按下update时,我想得到我刚刚修改过的唯一值。
发布于 2021-11-29 11:17:57
在update方法中,可以返回已更新的数据。在vue方面,当您收到成功的res.data时,您可以通过它来执行旧数据,然后Vue的反应性将更新。
您还可以共享组件的数据。
https://stackoverflow.com/questions/70152757
复制相似问题