Refactor #4433 - Message
parent
936ea04d10
commit
69de98e7ef
|
@ -57,6 +57,10 @@ const MessageSlots = [
|
||||||
{
|
{
|
||||||
name: 'closeicon',
|
name: 'closeicon',
|
||||||
description: 'Custom close icon template.'
|
description: 'Custom close icon template.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'container',
|
||||||
|
description: 'Custom container template.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,16 @@ export interface MessageSlots {
|
||||||
*/
|
*/
|
||||||
class: any;
|
class: any;
|
||||||
}): VNode[];
|
}): VNode[];
|
||||||
|
/**
|
||||||
|
* Custom container slot.
|
||||||
|
* @param {Object} scope - container slot's params.
|
||||||
|
*/
|
||||||
|
container(scope: {
|
||||||
|
/**
|
||||||
|
* Close message function.
|
||||||
|
*/
|
||||||
|
onClose: () => void;
|
||||||
|
}): VNode[];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="p-message" appear v-bind="ptm('transition')">
|
<transition name="p-message" appear v-bind="ptm('transition')">
|
||||||
<div v-show="visible" :class="cx('root')" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('root')" data-pc-name="message">
|
<div v-show="visible" :class="cx('root')" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('root')" data-pc-name="message">
|
||||||
<div :class="cx('wrapper')" v-bind="ptm('wrapper')">
|
<slot v-if="$slots.container" name="container" :onClose="close"></slot>
|
||||||
|
<div v-else :class="cx('wrapper')" v-bind="ptm('wrapper')">
|
||||||
<slot name="messageicon" class="p-message-icon">
|
<slot name="messageicon" class="p-message-icon">
|
||||||
<component :is="icon ? 'span' : iconComponent" :class="[cx('icon'), icon]" v-bind="ptm('icon')"></component>
|
<component :is="icon ? 'span' : iconComponent" :class="[cx('icon'), icon]" v-bind="ptm('icon')"></component>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
Loading…
Reference in New Issue