最近我发现SortableJS / Vue.Draggable库(https://github.com/SortableJS/Vue.Draggable)有一个新选项,可以启用多拖动以从数组中选择多个元素并将它们移动到一起(https://github.com/SortableJS/Vue.Draggable/pull/744)。
我看过它完美运行的示例,例如:
但是当我尝试在我的项目中使用它时,我只能找到使它工作的方法。
以下是我的项目的详细信息:
在我的 vue 组件中,我以这种方式导入了 vuedraggable:
import draggable from 'vuedraggable'
Run Code Online (Sandbox Code Playgroud)
我已经应用了这种方式(为了这篇文章的目的,代码已经减少了):
<template>
<v-flex class="pa-3">
<div class="instructions-wrapper py-4">
<v-avatar size="40" color="#4C2159" class="white--text"><b>4</b></v-avatar>
<div class="px-2">
<h2>Revisa y asigna</h2>
<p>Revisa la optimización del sistema y asigna o personaliza una ruta</p>
</div>
</div>
<template v-for="(vehicle, key) in sortedRoutes.routes">
<v-card class="my-4" :key="vehicle.stops.location_id">
<v-toolbar color="primary" dark>
<v-toolbar-title>{{ Object.keys(sortedRoutes.routes).find(key => sortedRoutes.routes[key] === vehicle) }}</v-toolbar-title>
</v-toolbar>
<draggable
:key="vehicle.stops.location_id"
:list="vehicle.stops"
:id="key" …Run Code Online (Sandbox Code Playgroud)