UNPKG

song-ui-u

Version:

vue3 + js的PC前端组件库

104 lines (95 loc) 3.02 kB
import { computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, renderSlot } from 'vue'; import { useNamespace } from '../../../hook/use-namespace/index.mjs'; import { useStyle } from '../../../hook/use-style/index.mjs'; import '../../../hook/use-zindex/index.mjs'; import { types } from '../../../utils/types.mjs'; import 'song-ui-pro-icon'; import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs'; const __default__ = { name: "x-badge" }; const _sfc_main = /*#__PURE__*/Object.assign(__default__, { props: { value: { type: [String, Number], default: "", }, placement: { type: String, default: "top-right", }, type: { type: String, default: "danger", }, size: { type: String, default: "default", }, max: { type: Number, default: 99, }, color: { type: String, default: "", }, outline: { type: Boolean, default: true, }, bgColor: { type: String, default: "", }, isDot: Boolean, opacity: { tyep: Number, default: 1, }, classNames: { type: String, default: "", }, }, setup(__props, { expose: __expose }) { __expose(); const ns = useNamespace("badge"); const s = useStyle(); /** props */ const props = __props; const content = computed(() => { const value = types().isNumber(props.value); const max = types().isNumber(props.max); if (value && max) { return props.max < props.value ? `${props.max}+` : `${props.value}`; } return props.value; }); const styleOpacity = computed(() => s.opacity(props.opacity)); const styleBgColor = computed(() => s.bgColor(props.bgColor)); const styleColor = computed(() => s.color(props.color)); const __returned__ = { ns, s, props, content, styleOpacity, styleBgColor, styleColor, computed, get useNamespace() { return useNamespace }, get useStyle() { return useStyle }, get types() { return types } }; Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true }); return __returned__ } }); function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return (openBlock(), createElementBlock("span", { class: normalizeClass([$setup.ns.b()]) }, [ createElementVNode("span", { class: normalizeClass([ $props.classNames, $setup.ns.e('content'), $setup.ns.m($props.type), $setup.ns.m('size', $props.size), $setup.ns.is('unoutline', !$props.outline), $setup.ns.is('dot', $props.isDot), ]), style: normalizeStyle([$setup.styleOpacity, $setup.styleBgColor, $setup.styleColor]) }, toDisplayString($props.isDot ? "" : $setup.content), 7 /* TEXT, CLASS, STYLE */), renderSlot(_ctx.$slots, "default") ], 2 /* CLASS */)) } var Badge = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"E:\\code\\my-code\\song-ui-ultra\\packages\\components\\badge\\src\\index.vue"]]); export { Badge as default }; //# sourceMappingURL=index.vue.mjs.map