@redseed/redseed-ui-vue3 2.11.16 → 2.11.17
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
|
@@ -30,6 +30,8 @@ const props = defineProps({
|
|
|
30
30
|
},
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
+
const imageElement = ref(null)
|
|
34
|
+
|
|
33
35
|
const large = computed(() => props.largeUrl || props.originalUrl)
|
|
34
36
|
const medium = computed(() => props.mediumUrl || props.originalUrl)
|
|
35
37
|
const small = computed(() => props.smallUrl || props.originalUrl)
|
|
@@ -84,6 +86,8 @@ const error = computed(() => {
|
|
|
84
86
|
|| smallImage.value.error
|
|
85
87
|
})
|
|
86
88
|
|
|
89
|
+
const isLoaded = ref(false)
|
|
90
|
+
|
|
87
91
|
const emit = defineEmits(['loading', 'error', 'ready'])
|
|
88
92
|
|
|
89
93
|
watch(isLoading, () => {
|
|
@@ -94,8 +98,13 @@ watch(error, () => {
|
|
|
94
98
|
if (error.value) emit('error', error.value)
|
|
95
99
|
}, { immediate: true, flush: 'post' })
|
|
96
100
|
|
|
97
|
-
watch(
|
|
98
|
-
if (
|
|
101
|
+
watch(isLoaded, () => {
|
|
102
|
+
if (isLoaded.value && isReady.value) {
|
|
103
|
+
emit('ready', {
|
|
104
|
+
ready: isReady.value,
|
|
105
|
+
imageElement: imageElement.value,
|
|
106
|
+
})
|
|
107
|
+
}
|
|
99
108
|
}, { immediate: true, flush: 'post' })
|
|
100
109
|
|
|
101
110
|
const sources = computed(() => {
|
|
@@ -152,7 +161,11 @@ const imageClass = computed(() => [
|
|
|
152
161
|
:media="media"
|
|
153
162
|
:srcset="srcset"
|
|
154
163
|
>
|
|
155
|
-
<img
|
|
164
|
+
<img ref="imageElement"
|
|
165
|
+
:src="originalUrl"
|
|
166
|
+
:alt="alt"
|
|
167
|
+
@load="isLoaded = true"
|
|
168
|
+
>
|
|
156
169
|
</picture>
|
|
157
170
|
</div>
|
|
158
171
|
</template>
|