hongluan-ui
Version:
Hongluan Component Library for Vue 3
68 lines (63 loc) • 2.08 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
require('../../../hooks/index.js');
require('../../../utils/index.js');
var badge = require('./badge2.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
var index = require('../../../hooks/use-namespace/index.js');
var types = require('../../../utils/types.js');
const _sfc_main = vue.defineComponent({
name: "Badge",
props: badge.badgeProps,
setup(props) {
const { namespace } = index.useNamespace("badge");
const content = vue.computed(() => {
if (props.dot) {
return "";
}
if (types.isNumber(props.value) && types.isNumber(props.max)) {
if (props.max < props.value) {
return `${props.max}+`;
}
return props.value === 0 && !props.showZero ? "" : `${props.value}`;
}
return `${props.value}`;
});
const style = vue.computed(() => {
return props.offset ? `
top: ${props.offset[0]};
right: ${props.offset[1]};
bottom: ${props.offset[2]};
left: ${props.offset[3]};
` : "";
});
return {
namespace,
content,
style
};
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
var _a;
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("em", {
class: vue.normalizeClass([
_ctx.namespace,
{
"dot": _ctx.dot,
"round": _ctx.round
},
_ctx.type ? _ctx.type : "",
_ctx.position,
_ctx.badgeClass
]),
style: vue.normalizeStyle([_ctx.style, { backgroundColor: _ctx.color }, (_a = _ctx.badgeStyle) != null ? _a : {}]),
textContent: vue.toDisplayString(_ctx.content)
}, null, 14, ["textContent"])), [
[vue.vShow, !_ctx.hidden && (_ctx.content || _ctx.content === "0" || _ctx.dot)]
]);
}
var Badge = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
exports["default"] = Badge;
//# sourceMappingURL=badge.js.map