1、安装依赖:npm install vuedraggable
2、引入vuedraggable:import vuedraggable from "vuedraggable";
3、注册组件:components: { vuedraggable }
4、使用组件:
<vuedraggable class="wrapper" v-model="dataForm.imageList">
<transition-group>
<div
v-for="(item, index) in dataForm.imageList"
:key="index"
class="images-class"
>
<img
style="width: 170px"
:src="IMAGE_PREVIEW_IP + item.fileUrl"
alt=""
/>
</div>
</transition-group>
</vuedraggable>