import { ElIcon } from 'element-plus' import { QuestionFilled } from '@element-plus/icons-vue' import { defineComponent, h, type Component } from 'vue' export default defineComponent({ name: 'PopConfirmContent', props: { title: String, message: String, icon: { type: [Object, String] as unknown as () => Component | string, default: () => QuestionFilled }, iconColor: { type: String, default: '#f90' }, hideIcon: { type: Boolean, default: false } }, setup (props, { slots }) { return () => { const titleContent = slots.title?.() ?? props.title const messageContent = slots.message?.() ?? props.message if (!titleContent && !messageContent) return null const showIcon = !props.hideIcon && props.icon const renderIcon = () => typeof props.icon === 'string' ? h('i', { class: props.icon }) : h(props.icon as Component) return (
{showIcon && ( {renderIcon()} )}
{titleContent && (
{titleContent}
)} {messageContent && (
{messageContent}
)}
) } } })