Vue project @change multiple parameters to pass multiple events

Vue project @change multiple parameters to pass multiple events

First, there is only one change event.

 changelevel() //Select value

If you want to change the select and change the value in the row

Multiple events are separated by

At this time, it is found that changelevel() is not executed, so what about adding ()

 changelevel(val){ console.log(val) => //undefined}

Indicates that no parameters are passed and output is undefined

So who should we pass the value to?

Pass in $event and output it again to get the selected value

Added: element-ui @change adds custom parameters

The default parameter of the change event of element-ui is a value. For example, the default parameter of the change event of the drop-down box is the selected value. However, in actual projects, we usually need to pass more than one parameter. If we directly append two parameters, we may not get them. In this case, we need to replace the default parameter name in the parameter with $event.

//The first parameter is the default value parameter, and the second is the parameter we want to pass in

 @change='selectChange($event,scope.row)'

Or use the second method:

 @change='(val)=>selectChange(value,scope.row)'

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me.

You may also be interested in:
  • In element-ui, the select component binding value changes, triggering the change event method
  • Solve the triggering problem of change event when vue elementUI uses el-select
  • How to pass custom parameters in vue select change event

<<:  Mysql5.7 service cannot be started. Graphical solution tutorial

>>:  MySQL SQL statement method to hide the middle four digits of the mobile phone number

Recommend

Detailed example of using the distinct method in MySQL

A distinct Meaning: distinct is used to query the...

Vue3.0 uses the vue-grid-layout plug-in to implement drag layout

Table of contents 1. Plugins 2. Interlude 3. Impl...

Implementation of fuzzy query like%% in MySQL

1, %: represents any 0 or more characters. It can...

Summary of 9 excellent code comparison tools recommended under Linux

When we write code, we often need to know the dif...

CentOS 7.5 deploys Varnish cache server function

1. Introduction to Varnish Varnish is a high-perf...

Summary of some tips on MySQL index knowledge

Table of contents 1. Basic knowledge of indexing ...

MySQL 5.7.27 winx64 installation and configuration method graphic tutorial

This article shares the installation and configur...

In-depth explanation of Session and Cookie in Tomcat

Preface HTTP is a stateless communication protoco...

Vue interpretation of responsive principle source code analysis

Table of contents initialization initState() init...

Detailed tutorial on installing Docker on CentOS 8

1. Previous versions yum remove docker docker-cli...

MySQL transaction analysis

Transaction A transaction is a basic unit of busi...

Summary of clipboard.js usage

Table of contents (1) Introduction: (2) The ways ...

An article to help you learn more about JavaScript arrays

Table of contents 1. The role of array: 2. Defini...