vuedraggable禁止拖出所在区域
时间: 2023-09-17 18:14:57
浏览: 59
要禁止使用vuedraggable拖出所在[区域](https://geek.csdn.net/educolumn/372157e1bc734b976821bd070a509a57?spm=1055.2569.3001.10083),可以通过设置vuedraggable组件的`options`[属性](https://geek.csdn.net/educolumn/5280ca4eda584c6baf7c2ec8010927f9?spm=1055.2569.3001.10083)中的`group`[属性](https://geek.csdn.net/educolumn/5280ca4eda584c6baf7c2ec8010927f9?spm=1055.2569.3001.10083)来实现。具体[步骤](https://geek.csdn.net/educolumn/41e918968ef7840279c31b7f6a0950e3?spm=1055.2569.3001.10083)如下:
1. 在父组件中引入`vuedraggable`组件,并设置组件的`options`属性中的`group`属性,例如:
```html
<template>
<h2>父组件</h2>
<div class="wrap[per](https://geek.csdn.net/educolumn/2c6ed1be7edac16b3c9a0c3228eaff0c?spm=1055.2569.3001.10083)">
<draggable v-model="list" :options="{group:'items'}">
<div v-for="item in list" :key="item.id" class="item">{{ item.name }}</div>
</draggable>
</template>
```