[Vuejs]-VueJS – pass data to component with existing row

0👍

modify your code like this:

addComponent() {
  this.address_components.push({id:++this.sort})
},
👤jacky

0👍

How about creating a list in your data() and just push a object there.

<ul id="example-1">
  <li v-for="item in items">
    {{ item.message }}
  </li>
</ul>

var example1 = new Vue({
  el: '#example-1',
  data: {
    items: []
  },
  methods:
  {
  Add:function()
  {
     //process the inputs and push it to items list
     this.items.push({ message: "Hi"})

  }
  }
})

Did not tested this and just created from example from Vue Documentation but you got the idea. Pushing a new item in list will automatically updates the component or the element

👤keysl

Leave a comment