@mixd-id/web-scaffold 0.1.2301231321 → 0.1.2301231323
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
package/src/components/Image.vue
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="computedOuterClass"
|
|
2
|
+
<div :class="computedOuterClass">
|
|
3
|
+
<slot v-if="editable && $slots['edit-area']" name="edit-area"></slot>
|
|
4
|
+
<div v-else-if="editable" :class="$style.editArea" @click="edit"></div>
|
|
3
5
|
<img :class="computedClass" :src="actualSrc" ref="img" :style="imageStyle"/>
|
|
4
6
|
<input v-if="Boolean(editable)" class="hidden" type="file" accept="image/*" ref="file" @change="onChange"/>
|
|
5
7
|
<slot></slot>
|
|
@@ -54,7 +56,8 @@ export default{
|
|
|
54
56
|
|
|
55
57
|
computedOuterClass(){
|
|
56
58
|
return [
|
|
57
|
-
this.$style.img
|
|
59
|
+
this.$style.img,
|
|
60
|
+
this.outerClass
|
|
58
61
|
]
|
|
59
62
|
.join(' ')
|
|
60
63
|
},
|
|
@@ -102,7 +105,7 @@ export default{
|
|
|
102
105
|
}
|
|
103
106
|
},
|
|
104
107
|
|
|
105
|
-
|
|
108
|
+
edit(){
|
|
106
109
|
if(this.$refs.file){
|
|
107
110
|
this.$refs.file.click()
|
|
108
111
|
}
|
|
@@ -193,6 +196,10 @@ export default{
|
|
|
193
196
|
@apply relative;
|
|
194
197
|
}
|
|
195
198
|
|
|
199
|
+
.editArea{
|
|
200
|
+
@apply absolute top-0 left-0 right-0 bottom-0;
|
|
201
|
+
}
|
|
202
|
+
|
|
196
203
|
.isLoading{
|
|
197
204
|
@apply absolute top-0 left-0 right-0 bottom-0;
|
|
198
205
|
@apply flex items-center justify-center;
|
|
@@ -248,13 +248,11 @@ export default{
|
|
|
248
248
|
|
|
249
249
|
mounted() {
|
|
250
250
|
this.socket.onAny(this.onHooks)
|
|
251
|
-
|
|
252
|
-
window.addEventListener('focus', () => {
|
|
253
|
-
//this.load()
|
|
254
|
-
})
|
|
251
|
+
window.addEventListener('focus', this.onFocus)
|
|
255
252
|
},
|
|
256
253
|
|
|
257
254
|
unmounted() {
|
|
255
|
+
window.removeEventListener('focus', this.onFocus)
|
|
258
256
|
this.socket.offAny(this.onHooks)
|
|
259
257
|
},
|
|
260
258
|
|
|
@@ -331,6 +329,10 @@ export default{
|
|
|
331
329
|
})
|
|
332
330
|
},
|
|
333
331
|
|
|
332
|
+
onFocus(){
|
|
333
|
+
this.load()
|
|
334
|
+
},
|
|
335
|
+
|
|
334
336
|
savePreset: throttle(function(preset) {
|
|
335
337
|
this.socketEmit('user.save-preset', { key:this.model, preset:{
|
|
336
338
|
presetIdx: this.presetIdx,
|
|
@@ -379,7 +381,7 @@ export default{
|
|
|
379
381
|
|
|
380
382
|
onHooks(module, event, items){
|
|
381
383
|
|
|
382
|
-
console.log('onHooks', module, event, items)
|
|
384
|
+
//console.log('onHooks', module, event, items)
|
|
383
385
|
|
|
384
386
|
if(!Array.isArray(items)) return
|
|
385
387
|
items = items.filter((_) => _).map((_) => {
|