K
K
kroha30002020-01-29 18:42:29
Vue.js
kroha3000, 2020-01-29 18:42:29

How to pass value on button click in vuejs input?

How to pass value on button click in vuejs input?

That is, I understand how to listen to input and pass it wherever you want. How about vice versa?

For example, there are 3 buttons/links. When clicking, we pass the assigned value to the input

This thing does not work, That is, if the variable is immediately displayed in the value input.

<input type="text" value="{ picked }">

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-01-29
@kroha3000

It should be something like this:

<input type="text" v-model="picked">
<button @click="picked = 'button clicked'">

That is, you have a variable. You pass its value to input. And then change the value wherever you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question