Get the App
SLTechnology News&Howtos  ›  Development  › 

How to understand event handling in getting started with VUE

Shulou Source: shulou.com Published: 2022-06-03 02:30:09 09月17日 Update

This article focuses on "how to understand event handling in the introduction to VUE". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to understand event handling in getting started with VUE".

1. Function binding

You can bind event handlers with vMuonVarion _ Click = "methodName" or the shortcut @ click= "methodName"

@ click= "methodName ()" is OK, @ click= "methodName" guess is abbreviated.

{count}} {{count}} data () {return {count: 0,};}, methods: {add () {this.count++;},}, 2. With parameters and $event

You can pass arguments and $event directly to the function bound by the event

{{count}} data () {return {count: 0,};}, methods: {add () {this.count++;}, set (value, event) {console.log (event); this.count = value;},}, 3. Multiple functions bind to one event

Multiple functions are directly separated by commas. Here, even functions without input parameters should be parenthesized, otherwise that function will not be executed.

For example, {{count}} only executes set

{{count}} data () {return {count: 0,};}, methods: {add () {this.count++;}, log () {console.log ("log---");}, set (value, event) {console.log (event); this.count = value;},}, 4. Event modifier

When using modifiers, order is important; the corresponding code is generated in the same order

...

...

...

5. Key modifier

.enter

.tab

.delete (capture delete and backspace keys)

.esc

.space

.up

.down

.left

.right

6. System modifier key

The modifier key must be pressed when the event is triggered

.ctrl

.alt

.shift

.meta

Do something

.destroy modifier

A

A

A

Mouse button modifier left-click mouse right-click mouse click here, I believe that everyone on the "introduction to VUE learning how to understand event handling" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Events functions processing mouse learning content parameters multiple order learning practical deeper important code interest practicality actual parentheses buttons keys Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Huawei Microsoft MariaDB