Fixed #7053
parent
450a68787d
commit
3f56ca656d
|
@ -57,6 +57,10 @@ export default {
|
||||||
onMouseLeave: {
|
onMouseLeave: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: undefined
|
default: undefined
|
||||||
|
},
|
||||||
|
onClick: {
|
||||||
|
type: Function,
|
||||||
|
default: undefined
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
style: ToastStyle,
|
style: ToastStyle,
|
||||||
|
|
|
@ -231,6 +231,18 @@ export interface ToastProps {
|
||||||
* @type {ToastMessageOptions}
|
* @type {ToastMessageOptions}
|
||||||
*/
|
*/
|
||||||
message?: ToastMessageOptions;
|
message?: ToastMessageOptions;
|
||||||
|
/**
|
||||||
|
* Used to specify a callback function to be run when the mouseenter event is fired on the message component.
|
||||||
|
*/
|
||||||
|
onMouseEnter?: Function | undefined;
|
||||||
|
/**
|
||||||
|
* Used to specify a callback function to be run when the mouseleave event is fired on the message component.
|
||||||
|
*/
|
||||||
|
onMouseLeave?: Function | undefined;
|
||||||
|
/**
|
||||||
|
* Used to specify a callback function to be run when the click event is fired on the message component.
|
||||||
|
*/
|
||||||
|
onClick?: Function | undefined;
|
||||||
/**
|
/**
|
||||||
* It generates scoped CSS variables using design tokens for the component.
|
* It generates scoped CSS variables using design tokens for the component.
|
||||||
*/
|
*/
|
||||||
|
@ -250,14 +262,6 @@ export interface ToastProps {
|
||||||
* @defaultValue false
|
* @defaultValue false
|
||||||
*/
|
*/
|
||||||
unstyled?: boolean;
|
unstyled?: boolean;
|
||||||
/**
|
|
||||||
* Used to specify a callback function to be run when the @mouseenter event is fired on the message component.
|
|
||||||
*/
|
|
||||||
onMouseEnter?: Function | undefined;
|
|
||||||
/**
|
|
||||||
* Used to specify a callback function to be run when the @mouseleave event is fired on the message component.
|
|
||||||
*/
|
|
||||||
onMouseLeave?: Function | undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="[cx('message'), message.styleClass]" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('message')" @mouseenter="onMouseEnter" @mouseleave="onMouseLeave">
|
<div :class="[cx('message'), message.styleClass]" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('message')" @click="onMessageClick" @mouseenter="onMouseEnter" @mouseleave="onMouseLeave">
|
||||||
<component v-if="templates.container" :is="templates.container" :message="message" :closeCallback="onCloseClick" />
|
<component v-if="templates.container" :is="templates.container" :message="message" :closeCallback="onCloseClick" />
|
||||||
<div v-else :class="[cx('messageContent'), message.contentStyleClass]" v-bind="ptm('messageContent')">
|
<div v-else :class="[cx('messageContent'), message.contentStyleClass]" v-bind="ptm('messageContent')">
|
||||||
<template v-if="!templates.message">
|
<template v-if="!templates.message">
|
||||||
|
@ -99,8 +99,11 @@ export default {
|
||||||
this.closeTimeout = null;
|
this.closeTimeout = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onMessageClick(event) {
|
||||||
|
this.props.onClick && this.props.onClick({ originalEvent: event, message: this.message });
|
||||||
|
},
|
||||||
onMouseEnter(event) {
|
onMouseEnter(event) {
|
||||||
this.props.onMouseEnter && this.props.onMouseEnter(event);
|
this.props.onMouseEnter && this.props.onMouseEnter({ originalEvent: event, message: this.message });
|
||||||
|
|
||||||
if (event.defaultPrevented) {
|
if (event.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
|
@ -113,7 +116,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMouseLeave(event) {
|
onMouseLeave(event) {
|
||||||
this.props.onMouseLeave && this.props.onMouseLeave(event);
|
this.props.onMouseLeave && this.props.onMouseLeave({ originalEvent: event, message: this.message });
|
||||||
|
|
||||||
if (event.defaultPrevented) {
|
if (event.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue