[Vuejs]-How to use v-for from computed property?

0👍

For the v-model, you need a property that satisfies the get and set operation.
Immutable transformation is required for component props.
For this reason, you can develop a solution like the example.

var bicomponent=Vue.component('biComponent', {
    template: `<div> 
  <draggable v-model="rows">
    <transition-group>
        <div v-for="(item, index) in rows" :key="item.id">
            {{item.text}}
        </div>
    </transition-group>
</draggable></div>`,
  components:{vuedraggable},
  props: {
    todoList: {
      type: Array,
      required: true,
      default: []
    }
  },
  data: function () {
        return {
            rows: this.todoList
        }
    }
});

jsfiddle example

Leave a comment