1 | <template> |
调用1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44<template>
<div class="box">
<dragAndDrop
class="contain"
v-for="(item, index) in arr"
:key="index"
:index="index"
>
{{index}}
</dragAndDrop>
</div>
</template>
<script>
import dragAndDrop from './components/drag';
export default {
data() {
return {
arr: [],
};
},
methods: {
},
components: {
dragAndDrop,
},
mounted() {
this.arr = new Array(9).fill(null);
// this.dragInit();
},
};
</script>
<style>
.box {
display: flex;
flex-wrap: wrap;
}
.contain {
width: 200px;
height: 200px;
background: purple;
margin: 20px;
font-size: 40px;
}
</style>
参考:
可实现demo: https://juejin.im/post/6844903824784621581
前置知识:
https://juejin.im/post/6844903513491767303#heading-6
sortablejs中文配置:
http://www.sortablejs.com/options.html
sortablejs demo:
https://sortablejs.github.io/Sortable/#swap