st-comp 0.0.271 → 0.0.272

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,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.271",
4
+ "version": "0.0.272",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -0,0 +1,52 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ tags: {
4
+ type: Array,
5
+ required: true,
6
+ },
7
+ });
8
+
9
+ const emit = defineEmits(["edit", "delete"]);
10
+
11
+ const handleEdit = (item) => {
12
+ emit("edit", item);
13
+ };
14
+
15
+ const handleDelete = (index) => {
16
+ emit("delete", index);
17
+ };
18
+ </script>
19
+
20
+ <template>
21
+ <div class="tags">
22
+ <el-tag
23
+ v-for="(item, index) in props.tags"
24
+ :key="item.key"
25
+ closable
26
+ type="info"
27
+ @close="handleDelete(index)"
28
+ >
29
+ <span>{{ item.tagText }}</span>
30
+ <span
31
+ class="edit"
32
+ @click="handleEdit(item)"
33
+ >编辑</span
34
+ >
35
+ </el-tag>
36
+ </div>
37
+ </template>
38
+
39
+ <style scoped>
40
+ .tags {
41
+ display: flex;
42
+ flex-wrap: wrap;
43
+ }
44
+ .tags .el-tag {
45
+ margin: 6px 10px 6px 0;
46
+ }
47
+ .tags .edit {
48
+ cursor: pointer;
49
+ color: var(--el-color-primary);
50
+ margin-left: 6px;
51
+ }
52
+ </style>