plus-pro-components
Version:
Page level components developed based on Element Plus.
102 lines (97 loc) • 3.05 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
require('../../../hooks/index.js');
var elementPlus = require('element-plus');
var useLocale = require('../../../hooks/useLocale.js');
const _hoisted_1 = {
key: 0,
style: { "padding-top": "12px" }
};
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "PlusPopover"
},
__name: "index",
props: {
hasShowBottomButton: { type: Boolean, default: false },
confirmLoading: { type: Boolean, default: false },
cancelText: { default: "" },
confirmText: { default: "" }
},
emits: ["cancel", "confirm"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const subVisible = vue.ref(false);
const { t } = useLocale.useLocale();
vue.watch(
() => props.visible,
(val) => {
subVisible.value = val;
},
{
immediate: true
}
);
const handleCancelPopover = () => {
subVisible.value = false;
emit("cancel");
};
const handleConfirmPopover = () => {
subVisible.value = false;
emit("confirm");
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElPopover), vue.mergeProps({
visible: subVisible.value,
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => subVisible.value = $event)
}, _ctx.$attrs), {
reference: vue.withCtx(() => [
vue.createElementVNode("span", null, [
vue.renderSlot(_ctx.$slots, "reference")
])
]),
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default"),
_ctx.hasShowBottomButton ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
vue.createVNode(vue.unref(elementPlus.ElButton), {
size: "small",
plain: "",
onClick: handleCancelPopover
}, {
default: vue.withCtx(() => [
vue.createTextVNode(
vue.toDisplayString(_ctx.cancelText || vue.unref(t)("plus.popover.cancelText")),
1
/* TEXT */
)
]),
_: 1
/* STABLE */
}),
vue.createVNode(vue.unref(elementPlus.ElButton), {
size: "small",
type: "primary",
loading: _ctx.confirmLoading,
onClick: handleConfirmPopover
}, {
default: vue.withCtx(() => [
vue.createTextVNode(
vue.toDisplayString(_ctx.confirmText || vue.unref(t)("plus.popover.confirmText")),
1
/* TEXT */
)
]),
_: 1
/* STABLE */
}, 8, ["loading"])
])) : vue.createCommentVNode("v-if", true)
]),
_: 3
/* FORWARDED */
}, 16, ["visible"]);
};
}
});
exports.default = _sfc_main;