mercredi 6 juin 2018

How to get route parameter from blade to vue

I have a route:

Route::get('/{my_parameter}/home', function($my_parameter) {
    return view('home_view')->with('my_parameter', $my_parameter);
}

In my home_view.blade.php file:

<div>
     
    <vue-component @click="doSomething(  )">Click me</vue-component> 
</div>

I've tried numerous variants as suggested in my searches, including @. When I use a hard-coded string, @click=doSomething('my_value'), the function works properly.

How do I successfully get a route parameter from blade for use in a vue component? Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire