Answer the question
In order to leave comments, you need to log in
How to pass data-value on click to a specific location?
<input type="text" value="Сюда">
<label data-value="Название"></label>
Answer the question
In order to leave comments, you need to log in
There is no need to pass any attribute values anywhere, this is not how things are done in vue. Let the current and possible values be properties of the component, and assign one to the other on click:
data: () => ({
value: '',
values: [ 'hello, world!!', 'fuck the world', 'fuck everything' ],
}),
<input v-model="value">
<button v-for="(n, i) in values" @click="value = n">set value #{{ i + 1 }}</button>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question