安装依赖:npm install vuedraggable --save
引入:import draggable from 'vuedraggable';
components: {
draggable
},
使用:
<draggable v-model="image" group="people" @change="change" @start="start" @end="end">
<div v-for="(item, index) in image" :key="index">
<img style="width: 100%;height: 100%" :src="item" alt="">
</div>
</draggable>
js:
监听
change(event) {
console.log('监听');
console.log(event);
console.log(this.image);
},
拖拽
start(event) {
console.log('拖拽');
console.log(event);
console.log(this.image);
},
结束
end() {
console.log('结束');
console.log(event);
console.log(this.image);
},
纯属个人记录个人不会的,请谅解