Home > Blockchain >  Get the updated value in laravel vuejs
Get the updated value in laravel vuejs

Time:11-30

I have a edit page : http://localhost/smp/post/12

enter image description here

API ROUTE:

Route::get('package', [ProductController::class, 'update']);

In ProductController.php

public function update(Request $request) {
    dd($request); // 
}

In product.vue

axios
.post("/promotion-platform/api/images/upload",{ 'id' : this.id })
          .then((res) => {
      console.log(res.data);
})

eg: I fix the name box from 'Iphone 13' to 'Iphone 12'. And when I press update then I want to get the unique value I just modified.

CodePudding user response:

on update method, you can return updated data. On the vue side when you received success res.data you can over right it to do old data, then Vue's reactivity will update.

You can share also data of the component

  • Related