I just started trying out Vue.js and applying it to an existing ASP.NET MVC 5 application.
The app has a form with a number of input controls:
<div id="vueApp">
...
@Html.TextBoxFor(model => model.FullName, new { @v_model = "fullName", @class = "form-control input" })
@Html.TextBoxFor(model => model.Branch, new { @v_model = "branch", @class = "form-control input" })
Some where at the end there's a summary to let users review the data before submitting:
<label>Name</label>: {{ fullName }}
<label>Branch</label>: {{ branch }}
The script is as follows:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script type="text/javascript">
myObject = new Vue({
el: '#vueApp',
data: {
fullName: '',
branch: ''
}
})
</script>
This works fine if starting with all fields empty. However, if some fields are initialized with values from the server, or when used to Edit existing records, the fields are shown as empty.