Fixed #2661 - New Image error event
parent
cdf42edd14
commit
9a419b91db
|
@ -15,6 +15,10 @@ const ImageEvents = [
|
||||||
{
|
{
|
||||||
name: "hide",
|
name: "hide",
|
||||||
description: "Triggered when the preview overlay is hidden."
|
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
|
* @memberof Image
|
||||||
*/
|
*/
|
||||||
hide: () => void;
|
hide: () => void;
|
||||||
|
/**
|
||||||
|
* Triggered when an error occurs while loading an image file.
|
||||||
|
*
|
||||||
|
* @memberof Image
|
||||||
|
*/
|
||||||
|
error: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
declare module '@vue/runtime-core' {
|
||||||
|
|
|
@ -42,6 +42,7 @@ import Portal from 'primevue/portal';
|
||||||
export default {
|
export default {
|
||||||
name: 'Image',
|
name: 'Image',
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
|
emits: ['show', 'hide', 'error'],
|
||||||
props: {
|
props: {
|
||||||
preview: {
|
preview: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -94,7 +95,7 @@ export default {
|
||||||
this.previewClick = false;
|
this.previewClick = false;
|
||||||
},
|
},
|
||||||
onError() {
|
onError() {
|
||||||
this.$emit('onError');
|
this.$emit('error');
|
||||||
},
|
},
|
||||||
rotateRight() {
|
rotateRight() {
|
||||||
this.rotate += 90;
|
this.rotate += 90;
|
||||||
|
|
|
@ -90,6 +90,11 @@ import Image from 'primevue/image';
|
||||||
<td>hide</td>
|
<td>hide</td>
|
||||||
<td>-</td>
|
<td>-</td>
|
||||||
<td>Triggered when the preview overlay is hidden.</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>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue