primevue-mirror/components/lib/inlinemessage/InlineMessage.vue

47 lines
1.2 KiB
Vue
Executable File

<template>
<div aria-live="polite" :class="cx('root')" v-bind="ptm('root')">
<slot name="icon">
<component :is="icon ? 'span' : iconComponent" :class="cx('icon')" v-bind="ptm('icon')"></component>
</slot>
<span :class="cx('text')" v-bind="ptm('text')">
<slot>&nbsp;</slot>
</span>
</div>
</template>
<script>
import BaseInlineMessage from './BaseInlineMessage.vue';
import CheckIcon from 'primevue/icons/check';
import ExclamationTriangleIcon from 'primevue/icons/exclamationtriangle';
import InfoCircleIcon from 'primevue/icons/infocircle';
import TimesCircleIcon from 'primevue/icons/timescircle';
export default {
name: 'InlineMessage',
extends: BaseInlineMessage,
timeout: null,
data() {
return {
visible: true
};
},
mounted() {
if (!this.sticky) {
setTimeout(() => {
this.visible = false;
}, this.life);
}
},
computed: {
iconComponent() {
return {
info: InfoCircleIcon,
success: CheckIcon,
warn: ExclamationTriangleIcon,
error: TimesCircleIcon
}[this.severity];
}
}
};
</script>