#methods

Type: {[key: king] | Function}

Methods are mixed into the Vue instance and can be accessed directly through the VM instance method, this.xx; Methods this is automatically bound to a vue instance.

Ps: Methods cannot be written as arrow functions, because arrow functions do not have this. This in the arrow function is defined as this, or this in the parent scope, and does not refer to the vue instance.

Event handling: V-On is provided in VUE to listen for DOM events, which can be triggered to run JS code.

When logic is complex, method names can be defined on v-ON instructions. Then we define methods in methods.

If you want to access native DOM objects, you can do so using $event in the inline processor.

Event modifier: In native JS, event.preventDefault() or event.stopPropagation()

These two commonly used methods of blocking events. In vUE, it can be easily represented by.stop, etc

.stop Prevents the click event from being propagated.

.prevent submits pages that no longer reload pages

.capture uses the event capture mechanism, which is passed from the outermost to the interior.

.self is the element itself, i.e. Event. Target is itself.

The.once event is triggered only once.

.passive The default action starts immediately and improves the performance of the mobile terminal.