UNPKG

@coreui/vue

Version:

UI Components Library for Vue.js

42 lines (39 loc) 1.22 kB
import { defineComponent, inject, h, resolveComponent } from 'vue'; import { CCloseButton } from '../close-button/CCloseButton.js'; const CToastClose = defineComponent({ name: 'CToastClose', props: { /** * Component used for the root node. Either a string to use a HTML element or a component. */ as: [String, Object], ...CCloseButton.props, }, emits: [ /** * Event called before the dissmiss animation has started. */ 'close', ], setup(props, { slots, emit }) { const updateVisible = inject('updateVisible'); const handleClose = () => { emit('close'); updateVisible(false); }; return () => props.as ? h(typeof props.as === 'string' ? resolveComponent(props.as) : props.as, { onClick: () => { handleClose(); }, }, () => slots.default && slots.default()) : h(CCloseButton, { ...props, onClick: () => { handleClose(); }, }); }, }); export { CToastClose }; //# sourceMappingURL=CToastClose.js.map