Answer the question
In order to leave comments, you need to log in
How to select text and put it in input?
Good time of the day, there is such a task, please help me solve it, there is a list of products that is displayed on the page through for, when you click on the name of the product, you need to put it in the input, if you click on another product, the name in the input will change to another))
<div>
<input type="text" >
<div v-for="phone in phones">
{{phone}}
</div>
</div>
export default {
data() {
return {
phones: ['iPhone 7', 'Galaxy S8', 'Nokia N8', 'Xiaomi Mi6']
}
},
Answer the question
In order to leave comments, you need to log in
<input type="text" v-model="inputPhone">
<div v-for="phone in phones" @click="inputPhone = phone">
{{phone}}
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question