Sharing my code snippet:
HTML:
<div id="user-panel">
<div class="text-center">
{{ fillItem }}
</div>
<form method="POST" action="http://site5/user_account/experiences/17" accept-charset="UTF-8" v-on:submit.prevent="updateItem(17)">
<input name="_method" type="hidden" value="PATCH">
<!-- Employer Field -->
<div class="form-group col-sm-6">
<label for="employer">Employer:</label>
<input class="form-control" v-model="fillItem.employer" name="employer" type="text" value="Some Emplyer" id="employer">
</div>
<!-- Designation Field -->
<div class="form-group col-sm-6">
<label for="designation">Designation:</label>
<input class="form-control" v-model="fillItem.designation" name="designation" type="text" value="some designation" id="designation">
</div>
<!-- Submit Field -->
<div class="form-group col-sm-12">
<input class="btn btn-primary" type="submit" value="Save">
</div>
</form>
</div>
Javascript:
<div id="user-panel">
<div class="text-center">
{{ fillItem }}
</div>
<form method="POST" action="http://site5/user_account/experiences/17" accept-charset="UTF-8" v-on:submit.prevent="updateItem(17)">
<input name="_method" type="hidden" value="PATCH">
<!-- Employer Field -->
<div class="form-group col-sm-6">
<label for="employer">Employer:</label>
<input class="form-control" v-model="fillItem.employer" name="employer" type="text" value="Some Emplyer" id="employer">
</div>
<!-- Designation Field -->
<div class="form-group col-sm-6">
<label for="designation">Designation:</label>
<input class="form-control" v-model="fillItem.designation" name="designation" type="text" value="some designation" id="designation">
</div>
<!-- Submit Field -->
<div class="form-group col-sm-12">
<input class="btn btn-primary" type="submit" value="Save">
</div>
</form>
</div>
Visit this jsfiddle link for a demo.
My goal is to populate vue object with default form field values.
Despite having default values in the form fields, vue renders them blank. How can I retrieve the default form values in vue considering that the values are dynamic, and the JavaScript code resides in a special.js file?