This will be a quick post on the vuejs model directive that might need to be used now and then when doing something with input elements in a template. The model directive may not need to always be used when working out an interface in a template but I have found that I need to use it with input, select, and text area tags. The vue model directive will make it so that you have two way bindings between input tags, and a value in the data object of a vue instance. So that when something changes in the data object, that change will effect the value of an input tag, and that if the user changes the value in the input tag that will change the value in the data object.
So lets start out with just a very simple example of the vue model directive that will help to show that the deal is with this one. Here I have a Vue instance a script tag that will mount to a hard coded html element my way of the vue el option. When it mounts the mount lief cycle hook will fire and call an add method that will add the value of the a, and b properties in the data object to get the value of c. This add method will also always fire when there is a change to the data object because of the updated hook. In my template I am making it so that there is a two way binding between input tags in the template, and corresponding values in the data object that I want to change when the user updates the value of the input tags.
So the Vue module directive is what needs to be used to make a two way binding between the value property of various HTML elements that are used to get user input, and the data object of a vue.js instance. I use it all the time in any template that requires the use of it.