first commit
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
"use strict";
|
||||
var common_vendor = require("../../../../common/vendor.js");
|
||||
var uni_modules_wotDesignUni_components_wdBadge_types = require("./types.js");
|
||||
var uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
||||
require("../common/props.js");
|
||||
require("../common/AbortablePromise.js");
|
||||
const __default__ = {
|
||||
name: "wd-badge",
|
||||
options: {
|
||||
addGlobalClass: true,
|
||||
virtualHost: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
};
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: uni_modules_wotDesignUni_components_wdBadge_types.badgeProps,
|
||||
setup(__props) {
|
||||
const props = __props;
|
||||
const content = common_vendor.computed$1(() => {
|
||||
const { modelValue, max, isDot } = props;
|
||||
if (isDot)
|
||||
return "";
|
||||
let value = modelValue;
|
||||
if (value && max && uni_modules_wotDesignUni_components_common_util.isNumber(value) && !Number.isNaN(value) && !Number.isNaN(max)) {
|
||||
value = max < value ? `${max}+` : value;
|
||||
}
|
||||
return value;
|
||||
});
|
||||
const contentStyle = common_vendor.computed$1(() => {
|
||||
const style = {};
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(props.bgColor)) {
|
||||
style.backgroundColor = props.bgColor;
|
||||
}
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(props.top)) {
|
||||
style.top = uni_modules_wotDesignUni_components_common_util.addUnit(props.top);
|
||||
}
|
||||
if (uni_modules_wotDesignUni_components_common_util.isDef(props.right)) {
|
||||
style.right = uni_modules_wotDesignUni_components_common_util.addUnit(props.right);
|
||||
}
|
||||
return uni_modules_wotDesignUni_components_common_util.objToStyle(style);
|
||||
});
|
||||
const shouldShowBadge = common_vendor.computed$1(() => !props.hidden && (content.value || content.value === 0 && props.showZero || props.isDot));
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.unref(shouldShowBadge)
|
||||
}, common_vendor.unref(shouldShowBadge) ? {
|
||||
b: common_vendor.t(common_vendor.unref(content)),
|
||||
c: common_vendor.n(_ctx.type ? "wd-badge__content--" + _ctx.type : ""),
|
||||
d: common_vendor.n(_ctx.isDot ? "is-dot" : ""),
|
||||
e: common_vendor.s(common_vendor.unref(contentStyle))
|
||||
} : {}, {
|
||||
f: common_vendor.n(_ctx.customClass),
|
||||
g: common_vendor.s(_ctx.customStyle)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-63f38c73"], ["__file", "D:/\u7F51\u6291\u4E91Time/\u79C1\u6D3B/2000\u7B97\u5366/src/uni_modules/wot-design-uni/components/wd-badge/wd-badge.vue"]]);
|
||||
wx.createComponent(Component);
|
||||
Reference in New Issue
Block a user