Look at how we define the function
var VM = new new Vue ({
// find the ID for the scope of APP EL: "#app" ,
// Data Data: { MSG: "Vue the Hello" , NUM: 0 },
// Methods that function definition VUE at Methods: {
// function name function body handle: function (Event) {
// Check the current contents of the trigger function of the console.log (event.target.value); the this .num ++ ; }, handle1 handle that: function (Event) {
/ / View trigger label function console.log (event.target.tagName); console.log (event.target.value); // So far, innerHTML seems to not work in the MVC, the acquisition is less than the value of console.log (event.target.innerHTML) the this .num ++ ; } } })
@ * $ event parameter passing, fixed the name of the event binding - passing parameters 1, if time is directly binding function name as v-on: click = "handle ", then the default event object is passed as the first argument of event parameters 2, if the time bind function calls such as v-on: click = "handle1 ($ event)", then the event display object must be passed as the last parameter, and the name of the event event must be $ * @ @ * use methods num increment, the method is defined @ * methods < the INPUT the above mentioned id = "Button1" v-ON: the Click = "handle" of the type = "the Button" value = "event binding value increment" /> < the INPUT the above mentioned id = "Button1" ON-v: the Click = "handle1 ($ event)" of the type = "the Button" value = "event binding value increment" />
The above code is to explain the definition of the function, as well as a presentation call, event of