I have a global component in a Laravel application that is being passed the id of a model (not as in MVC) as a prop. I am assigning it to a local variable in the created hook and just trying to display it. I am also displaying the id from the Laravel controller in the blade file for reference. I see the Laravel id and the button but not the local variable. Am I understanding Vue.js incorrectly???
laravel controller:
public function model($id)
{
$model = AdcModel::whereId($id)->first();
return view('model', compact('model'));
} // end function
blade file:
@section('content')
<div class="padded__container" style="margin-top: 60px;">
<model-view
:current_user=""
:modelID=""></model-view>
</div>
@endsection
and component
<template>
<span>
<a class="button is-success" href="/modeler">Back</a>
</span>
</template>
<script type="text/babel">
export default {
data() {
return {
current_model_id: null
};
},
created() {
this.current_model_id = this.modelID;
},
props: ['modelID']
};
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire