R
R
Rukis2018-09-17 20:57:42
Vue.js
Rukis, 2018-09-17 20:57:42

Vue, how to make changes in one field affect the value in another?

I have created a component to display a styled input field. There may be several such fields on the page tied to the same data, so when changing the value in one field, I expect the value to change in the other (this is how it would work with ordinary fields not wrapped in a component). But it doesn't and I don't understand why.
Link to the code with an example https://codepen.io/anon/pen/dqgRdg - I need fields 1 and 2 to work the same as fields 3 and 4.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-09-17
@rukis

Use a parameter as the input value, like this . You can even wrap it in a computed property with a setter - then inside the component you can use v-model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question