File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 3
3
<div v-for =" image of imageUrls"
4
4
class =" relative w-[120px] h-[120px] rounded border border-dashed flex items-center justify-center hover:border-purple-500 overflow-hidden" >
5
5
<img :src =" image.url" class =" max-w-full max-h-full" :class =" image.deleted ? 'opacity-50' : ''" >
6
- <span v-if =" image.deleted" class =" absolute left-0 bottom-0 right-0 py-1 px-2 bg-black w-100 text-white text -center flex" >
6
+ <small v-if =" image.deleted" class =" absolute left-0 bottom-0 right-0 py-1 px-2 bg-black w-100 text-white justify-between items -center flex" >
7
7
To be deleted
8
- </span >
8
+ <svg xmlns =" http://www.w3.org/2000/svg" fill =" none" viewBox =" 0 0 24 24" stroke-width =" 1.5" stroke =" currentColor" class =" w-4 h-4 cursor-pointer" @click =" revertImage(image)" >
9
+ <path stroke-linecap =" round" stroke-linejoin =" round" d =" M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3" />
10
+ </svg >
11
+ </small >
9
12
<span class =" absolute top-1 right-1 cursor-pointer" @click =" removeImage(image)" >
10
13
<svg xmlns =" http://www.w3.org/2000/svg" viewBox =" 0 0 20 20" fill =" currentColor" class =" w-5 h-5" >
11
14
<path
@@ -86,6 +89,15 @@ function removeImage(image) {
86
89
}
87
90
}
88
91
92
+ function revertImage (image ){
93
+ if (image .isProp ) {
94
+ deletedImages .value = deletedImages .value .filter (id => id !== image .id )
95
+ image .deleted = false ;
96
+
97
+ emit (' update:deletedImages' , deletedImages .value )
98
+ }
99
+ }
100
+
89
101
// Hooks
90
102
watch (' props.images' , () => {
91
103
console .log (props .images )
You can’t perform that action at this time.
0 commit comments