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

Beginners learn some HTML tags (2)

Beginners can learn HTML by understanding some HT...

JS+Canvas realizes dynamic clock effect

A dynamic clock demo based on Canvas is provided ...

HTML+CSS makes div tag add delete icon in the upper right corner sample code

1. Requirements description Display the delete ic...

Detailed explanation of encoding issues during MySQL command line operations

1. Check the MySQL database encoding mysql -u use...

Linux Network System Introduction

Table of contents Network Information Modify the ...

MySQL batch removes spaces in a certain field

Is there any way to remove spaces from a certain ...

vue element el-transfer adds drag function

The Core Asset Management Project requires el-tra...

Example of creating table statements for user Scott in MySQL version of Oracle

Overview: Oracle scott user has four tables, whic...

Several ways to store images in MySQL database

Usually the pictures uploaded by users need to be...

How to run postgreSQL with docker

1. Install Docker. Reference URL: Docker Getting ...

Detailed steps to delete environment variables in Linux

How to delete environment variables in Linux? Use...

Detailed comparison of Ember.js and Vue.js

Table of contents Overview Why choose a framework...

Detailed explanation of asynchronous programming knowledge points in nodejs

Introduction Because JavaScript is single-threade...