amshinski
amshinski

Reputation: 184

Vue3 How to pass input's value to method in @change="func(param)"?

I have an input field and I need to call the function every time when value is changed and pass the new value to the function. I couldn't find how to do it.

<template slot-scope="scope">
    <el-input
    type="text"
    :value="scope.row.name"
    v-model="queryName"
    @change="changeQueryName(scope.row.id, ???.queryName)">
    </el-input>
</template>

Upvotes: 4

Views: 3412

Answers (1)

MuXeD
MuXeD

Reputation: 449

You can pass the $event

@change="changeQueryName($event, scope.row.id, ???.queryName)"

This is de doc HTMLElement: Event

In the changeQueryName() function you can use event.target.value

changeQueryName(event, id, queryName) {
   console.log(event.target.value)
}

Upvotes: 4

Related Questions