appsnbcbweicheng 1.2.16 → 1.2.18

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appsnbcbweicheng",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -8,4 +8,4 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "description": ""
11
- }
11
+ }
package/public/App.vue ADDED
@@ -0,0 +1,122 @@
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>
package/readme.md CHANGED
@@ -1,3 +1,5 @@
1
+ 1.2.18 标签拖动
2
+ 1.2.17 done,close icon
1
3
  1.2.16 replac$post
2
4
  1.2.15 replac '/addd/cddd'
3
5
  1.2.14 vuetools6.6
@@ -1,48 +0,0 @@
1
- const fs = require("fs")
2
- const path = require("path")
3
-
4
- // 匹配 this.$post(函数名, 参数)
5
- const regex = /this\.\$post\s*\(\s*([a-zA-Z_$][\w$]*)\s*,/g
6
-
7
- // 需要处理的文件类型
8
- const exts = [".js", ".ts", ".vue"]
9
-
10
- /**
11
- * 处理单个文件
12
- * @param {string} filePath - 文件路径
13
- */
14
- function processFile(filePath) {
15
- if (!exts.includes(path.extname(filePath))) return
16
-
17
- let code = fs.readFileSync(filePath, "utf8")
18
- if (regex.test(code)) {
19
- const newCode = code.replace(regex, "$1(")
20
- fs.writeFileSync(filePath, newCode, "utf8")
21
- console.log("✅ 已处理文件:", filePath)
22
- }
23
- }
24
-
25
- /**
26
- * 递归处理目录
27
- * @param {string} dirPath - 目录路径
28
- */
29
- function processDir(dirPath) {
30
- const files = fs.readdirSync(dirPath)
31
- for (const file of files) {
32
- const fullPath = path.join(dirPath, file)
33
- const stat = fs.statSync(fullPath)
34
-
35
- if (stat.isDirectory()) {
36
- processDir(fullPath) // 递归子目录
37
- } else {
38
- processFile(fullPath)
39
- }
40
- }
41
- }
42
-
43
- // ========== 使用示例 ==========
44
- // 处理单个文件
45
- processFile(path.resolve(__dirname, "test.js"))
46
-
47
- // 处理整个目录
48
- // processDir(path.resolve(__dirname, "src"))