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
}
}
});
- [Vuejs]-All buttons effect only the first button, but not themselves
- [Vuejs]-Vue JS – Prevent show duplicate value in v-for
Source:stackexchange.com