hongluan-ui
Version:
Hongluan Component Library for Vue 3
110 lines (105 loc) • 3.85 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var index = require('../../icon/index.js');
require('../../system-icon/index.js');
require('../../../hooks/index.js');
var tag = require('./tag2.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var close = require('../../system-icon/src/close.js');
var index$1 = require('../../../hooks/use-namespace/index.js');
var index$2 = require('../../../hooks/use-consistent-prop/index.js');
const _sfc_main = vue.defineComponent({
name: "Tag",
components: {
HlIcon: index.HlIcon,
SystemClose: close["default"]
},
props: tag.tagProps,
emits: ["close", "click"],
setup(props, { emit }) {
const { namespace } = index$1.useNamespace("tag");
const { size: tagSize } = index$2.useConsistentProp();
const classes = vue.computed(() => {
const { type, effect, outline, round, active } = props;
return [
namespace.value,
type ? type : "",
tagSize.value ? `${tagSize.value}` : "",
effect && effect,
outline ? "outline" : "",
round ? "round" : "",
active ? "is-focus" : ""
];
});
const handleClose = (event) => {
event.stopPropagation();
emit("close", event);
};
const handleClick = (event) => {
emit("click", event);
};
return {
classes,
handleClose,
handleClick
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_system_close = vue.resolveComponent("system-close");
const _component_hl_icon = vue.resolveComponent("hl-icon");
return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
key: 0,
class: vue.normalizeClass(_ctx.classes),
style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
onClick: _ctx.handleClick
}, [
_ctx.$slots.prefix ? vue.renderSlot(_ctx.$slots, "prefix", { key: 0 }) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("span", null, [
vue.renderSlot(_ctx.$slots, "default")
]),
_ctx.$slots.suffix ? vue.renderSlot(_ctx.$slots, "suffix", { key: 1 }) : vue.createCommentVNode("v-if", true),
_ctx.closable ? (vue.openBlock(), vue.createBlock(_component_hl_icon, {
key: 2,
class: "tag-close",
onClick: _ctx.handleClose
}, {
default: vue.withCtx(() => [
vue.createVNode(_component_system_close)
]),
_: 1
}, 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
], 14, ["onClick"])) : (vue.openBlock(), vue.createBlock(vue.Transition, {
key: 1,
name: "zoom-in-center"
}, {
default: vue.withCtx(() => [
vue.createElementVNode("span", {
class: vue.normalizeClass(_ctx.classes),
style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
onClick: _ctx.handleClick
}, [
_ctx.$slots.prefix ? vue.renderSlot(_ctx.$slots, "prefix", { key: 0 }) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("span", null, [
vue.renderSlot(_ctx.$slots, "default")
]),
_ctx.$slots.suffix ? vue.renderSlot(_ctx.$slots, "suffix", { key: 1 }) : vue.createCommentVNode("v-if", true),
_ctx.closable ? (vue.openBlock(), vue.createBlock(_component_hl_icon, {
key: 2,
class: "tag-close",
onClick: _ctx.handleClose
}, {
default: vue.withCtx(() => [
vue.createVNode(_component_system_close)
]),
_: 1
}, 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
], 14, ["onClick"])
]),
_: 3
}));
}
var Tag = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
exports["default"] = Tag;
//# sourceMappingURL=tag.js.map