Fixed #2661 - New Image error event
parent
cdf42edd14
commit
9a419b91db
|
@ -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."
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -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' {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue