appsnbcbweicheng 1.2.18 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/btnSelect.zip +0 -0
- package/readme.md +1 -0
- package/public/App.vue +0 -122
package/package.json
CHANGED
|
Binary file
|
package/readme.md
CHANGED
package/public/App.vue
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="drag-select-element">
|
|
3
|
-
<!-- 已选择区域 -->
|
|
4
|
-
<div class="section">
|
|
5
|
-
<h4>已选择:</h4>
|
|
6
|
-
<draggable
|
|
7
|
-
v-model="selectedList"
|
|
8
|
-
class="tag-container"
|
|
9
|
-
:group="{ name: 'tags', pull: true, put: true }"
|
|
10
|
-
:animation="200"
|
|
11
|
-
>
|
|
12
|
-
<el-tag
|
|
13
|
-
v-for="item in selectedList"
|
|
14
|
-
:key="item.id"
|
|
15
|
-
closable
|
|
16
|
-
type="success"
|
|
17
|
-
@close="removeItem(item)"
|
|
18
|
-
>
|
|
19
|
-
{{ item.name }}
|
|
20
|
-
</el-tag>
|
|
21
|
-
</draggable>
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<!-- 待选区域 -->
|
|
25
|
-
<div class="section">
|
|
26
|
-
<h4>待选:</h4>
|
|
27
|
-
<draggable
|
|
28
|
-
v-model="optionList"
|
|
29
|
-
class="tag-container"
|
|
30
|
-
:group="{ name: 'tags', pull: true, put: true }"
|
|
31
|
-
:animation="200"
|
|
32
|
-
>
|
|
33
|
-
<el-tag
|
|
34
|
-
v-for="item in optionList"
|
|
35
|
-
:key="item.id"
|
|
36
|
-
type="info"
|
|
37
|
-
@click="selectItem(item)"
|
|
38
|
-
>
|
|
39
|
-
{{ item.name }}
|
|
40
|
-
</el-tag>
|
|
41
|
-
</draggable>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
import draggable from "vuedraggable";
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
name: "ElementDragSelect",
|
|
51
|
-
components: { draggable },
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
selectedList: [
|
|
55
|
-
{ id: 1, name: "已选 A" },
|
|
56
|
-
{ id: 2, name: "已选 B" },
|
|
57
|
-
],
|
|
58
|
-
optionList: [
|
|
59
|
-
{ id: 3, name: "选项 C" },
|
|
60
|
-
{ id: 4, name: "选项 D" },
|
|
61
|
-
{ id: 5, name: "选项 E" },
|
|
62
|
-
{ id: 6, name: "选项 F" },
|
|
63
|
-
{ id: 7, name: "选项 G" },
|
|
64
|
-
{ id: 8, name: "选项 H" },
|
|
65
|
-
{ id: 9, name: "选项 I" },
|
|
66
|
-
{ id: 10, name: "选项 J" },
|
|
67
|
-
{ id: 11, name: "选项 K" },
|
|
68
|
-
{ id: 12, name: "选项 L" },
|
|
69
|
-
{ id: 13, name: "选项 M" },
|
|
70
|
-
{ id: 14, name: "选项 N" },
|
|
71
|
-
{ id: 15, name: "选项 O" },
|
|
72
|
-
{ id: 16, name: "选项 P" },
|
|
73
|
-
{ id: 17, name: "选项 Q" },
|
|
74
|
-
{ id: 18, name: "选项 R" },
|
|
75
|
-
{ id: 19, name: "选项 S" },
|
|
76
|
-
{ id: 20, name: "选项 T" },
|
|
77
|
-
{ id: 21, name: "选项 U" },
|
|
78
|
-
{ id: 22, name: "选项 V" },
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
],
|
|
82
|
-
};
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
selectItem(item) {
|
|
86
|
-
this.optionList = this.optionList.filter((o) => o.id !== item.id);
|
|
87
|
-
this.selectedList.push(item);
|
|
88
|
-
},
|
|
89
|
-
removeItem(item) {
|
|
90
|
-
this.selectedList = this.selectedList.filter((s) => s.id !== item.id);
|
|
91
|
-
this.optionList.push(item);
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<style scoped>
|
|
98
|
-
.drag-select-element {
|
|
99
|
-
display: flex;
|
|
100
|
-
flex-direction: column;
|
|
101
|
-
gap: 20px;
|
|
102
|
-
max-width: 600px; /* 整个组件最大宽度 */
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.section {
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tag-container {
|
|
111
|
-
display: flex;
|
|
112
|
-
flex-wrap: wrap;
|
|
113
|
-
gap: 8px;
|
|
114
|
-
padding: 8px;
|
|
115
|
-
border: 1px solid #dcdfe6;
|
|
116
|
-
border-radius: 6px;
|
|
117
|
-
min-height: 50px;
|
|
118
|
-
max-width: 100%;
|
|
119
|
-
background-color: #fafafa;
|
|
120
|
-
box-sizing: border-box;
|
|
121
|
-
}
|
|
122
|
-
</style>
|