首页 > 解决方案 > vuejs dynamic input collection with wrong values

问题描述

I am dynamically adding inputs of type text to a vuex collection. It adds the input at specific index. It works good, no problem with that. The issue happens when I write some value in the input and then try to add a new one. The input value jumps to the newly added input. Here is a simple code example: https://codesandbox.io/s/0yrzrw6120

Steps to reproduce:

There is a default input. You can add inputs below that, so:

  1. Add a new input.
  2. Write some value in the newly added input.
  3. Add a new input again from the default button.

What I am expecting is a new input below default with no value in it, and it works but the value of the last input jumps to the newly added.

I understand is not a problem with the additions of items but the value in the inputs.

标签: vue.jsinputvuexv-for

解决方案


推荐阅读