Merge pull request #2663 from tugcekucukoglu/image-error

Fixed #2661 - New Image error event
pull/2665/head
Tuğçe Küçükoğlu 2022-06-14 11:29:49 +03:00 committed by GitHub
commit e5fd1087d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View File

@ -15,6 +15,10 @@ const ImageEvents = [
{
name: "hide",
description: "Triggered when the preview overlay is hidden."
},
{
name: "error",
description: "Triggered when an error occurs while loading an image file."
}
];

View File

@ -39,6 +39,12 @@ declare class Image extends ClassComponent<ImageProps, ImageSlots, ImageEmits> {
* @memberof Image
*/
hide: () => void;
/**
* Triggered when an error occurs while loading an image file.
*
* @memberof Image
*/
error: () => void;
}
declare module '@vue/runtime-core' {

View File

@ -42,6 +42,7 @@ import Portal from 'primevue/portal';
export default {
name: 'Image',
inheritAttrs: false,
emits: ['show', 'hide', 'error'],
props: {
preview: {
type: Boolean,
@ -94,7 +95,7 @@ export default {
this.previewClick = false;
},
onError() {
this.$emit('onError');
this.$emit('error');
},
rotateRight() {
this.rotate += 90;

View File

@ -90,6 +90,11 @@ import Image from 'primevue/image';
<td>hide</td>
<td>-</td>
<td>Triggered when the preview overlay is hidden.</td>
</tr>
<tr>
<td>error</td>
<td>-</td>
<td>Triggered when an error occurs while loading an image file.</td>
</tr>
</tbody>
</table>