Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 871
amshinski Avatar asked Oct 23 '25 09:10

amshinski


1 Answers

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)
}
like image 90
MuXeD Avatar answered Oct 26 '25 01:10

MuXeD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!