@xdp/button
Version:
button el-button vue3
61 lines (58 loc) • 1.91 kB
JavaScript
import { defineComponent, createVNode, isVNode, h } from 'vue';
import { ElIcon } from 'element-plus';
import { QuestionFilled } from '@element-plus/icons-vue';
function _isSlot(s) {
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
var popConfirmContent = defineComponent({
name: "PopConfirmContent",
props: {
title: String,
message: String,
icon: {
type: [Object, String],
default: () => QuestionFilled
},
iconColor: {
type: String,
default: "#f90"
},
hideIcon: {
type: Boolean,
default: false
}
},
setup(props, {
slots
}) {
return () => {
var _a, _b, _c, _d;
let _slot;
const titleContent = (_b = (_a = slots.title) == null ? void 0 : _a.call(slots)) != null ? _b : props.title;
const messageContent = (_d = (_c = slots.message) == null ? void 0 : _c.call(slots)) != null ? _d : 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);
return createVNode("div", {
"class": "cip-button-pop__content"
}, [showIcon && createVNode(ElIcon, {
"class": "cip-button-pop__content-icon",
"style": {
color: props.iconColor
}
}, _isSlot(_slot = renderIcon()) ? _slot : {
default: () => [_slot]
}), createVNode("div", {
"class": "cip-button-pop__content-body"
}, [titleContent && createVNode("div", {
"class": "cip-button-pop__content-title"
}, [titleContent]), messageContent && createVNode("div", {
"class": "cip-button-pop__content-message"
}, [messageContent])])]);
};
}
});
export { popConfirmContent as default };