title: How can I store the value of each input into vuex?
body: <p>This is my &quot;Test.vue&quot;components</p>
  <pre><code>
      &lt;template&gt;
      &lt;div&gt;
        &lt;div&gt;
            &lt;button  @click=&quot;decrenumber (id)&quot;&gt;-&lt;/button&gt;
            &lt;input name=&quot;test&quot; type=&quot;text&quot; :key=&quot;id&quot; v-model.number=&quot;num&quot;&gt;
            &lt;label for=&quot;test&quot; &gt;&lt;/label&gt;
            &lt;button @click=&quot;increnumber (id)&quot;&gt;+&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;/template&gt;
      &lt;script&gt;
      import { mapState } from 'vuex';
      
      export default {
        name: 'Test',
        data() {
          return {
            num: 0,
          };
        },
        props: {
          id: { type: Number, default: 0 },
        },
        methods: {
          increnumber(id) {
            this.num += 1;
            this.$emit('update', this.num);
          },
          decrenumber(id) {
            this.num -= 1;
            this.$emit('update', this.num);
          },
        },
      };
      &lt;/script&gt;
  
  </code></pre>
  <p><code>And I have 5 Test.vue components in my TestView.vue</code></p>
  <pre><code>
      &lt;template&gt;
          &lt;div &gt;
             &lt;Test :id=&quot;index&quot; v-for=&quot;(n,index) in 5&quot; @update=&quot;selfUpdate&quot;&gt;&lt;/Test&gt;
          &lt;/div&gt;
      &lt;/template&gt;
      &lt;script&gt;
      
      import Test from '../components/Test.vue';
      
      export default {
        name: 'TestView',
        components: {
          Test,
        },
        data() {
          return {
            inputValue: 0,
          };
        },
        methods: {
          selfUpdate(num) {
            this.inputValue = num;
            this.$store.state.test.number = this.inputValue;
          },
        },
      };
      &lt;/script&gt;
  
  </code></pre>
  <p>How can I store the value of each input from TestView.vue into vuex?
  I know it is possible to use array.push() but this keeps increasing
  How did I just make the input only exist in five indexes,
  If you enter the input in the same field, it can replace the old value</p>