104 lines
4.2 KiB
JavaScript
104 lines
4.2 KiB
JavaScript
"use strict";
|
|
var common_vendor = require("../../../../common/vendor.js");
|
|
var uni_modules_wotDesignUni_components_common_util = require("../common/util.js");
|
|
var uni_modules_wotDesignUni_components_composables_useParent = require("../composables/useParent.js");
|
|
var uni_modules_wotDesignUni_components_wdTabbar_types = require("../wd-tabbar/types.js");
|
|
var uni_modules_wotDesignUni_components_wdTabbarItem_types = require("./types.js");
|
|
require("../common/AbortablePromise.js");
|
|
require("../common/props.js");
|
|
if (!Math) {
|
|
(wdIcon + wdBadge)();
|
|
}
|
|
const wdBadge = () => "../wd-badge/wd-badge.js";
|
|
const wdIcon = () => "../wd-icon/wd-icon.js";
|
|
const __default__ = {
|
|
name: "wd-tabbar-item",
|
|
options: {
|
|
addGlobalClass: true,
|
|
virtualHost: true,
|
|
styleIsolation: "shared"
|
|
}
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
...__default__,
|
|
props: uni_modules_wotDesignUni_components_wdTabbarItem_types.tabbarItemProps,
|
|
setup(__props) {
|
|
const props = __props;
|
|
const { parent: tabbar, index } = uni_modules_wotDesignUni_components_composables_useParent.useParent(uni_modules_wotDesignUni_components_wdTabbar_types.TABBAR_KEY);
|
|
const customBadgeProps = common_vendor.computed$1(() => {
|
|
const badgeProps = uni_modules_wotDesignUni_components_common_util.deepAssign(
|
|
uni_modules_wotDesignUni_components_common_util.isDef(props.badgeProps) ? uni_modules_wotDesignUni_components_common_util.omitBy(props.badgeProps, uni_modules_wotDesignUni_components_common_util.isUndefined) : {},
|
|
uni_modules_wotDesignUni_components_common_util.omitBy(
|
|
{
|
|
max: props.max,
|
|
isDot: props.isDot,
|
|
modelValue: props.value
|
|
},
|
|
uni_modules_wotDesignUni_components_common_util.isUndefined
|
|
)
|
|
);
|
|
if (!uni_modules_wotDesignUni_components_common_util.isDef(badgeProps.max)) {
|
|
badgeProps.max = 99;
|
|
}
|
|
return badgeProps;
|
|
});
|
|
const textStyle = common_vendor.computed$1(() => {
|
|
const style = {};
|
|
if (tabbar) {
|
|
if (active.value && tabbar.props.activeColor) {
|
|
style["color"] = tabbar.props.activeColor;
|
|
}
|
|
if (!active.value && tabbar.props.inactiveColor) {
|
|
style["color"] = tabbar.props.inactiveColor;
|
|
}
|
|
}
|
|
return `${uni_modules_wotDesignUni_components_common_util.objToStyle(style)}`;
|
|
});
|
|
const active = common_vendor.computed$1(() => {
|
|
const name = uni_modules_wotDesignUni_components_common_util.isDef(props.name) ? props.name : index.value;
|
|
if (tabbar) {
|
|
if (tabbar.props.modelValue === name) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
});
|
|
function handleClick() {
|
|
const name = uni_modules_wotDesignUni_components_common_util.isDef(props.name) ? props.name : index.value;
|
|
tabbar && tabbar.setChange({ name });
|
|
}
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.r("icon", {
|
|
active: common_vendor.unref(active)
|
|
}),
|
|
b: !_ctx.$slots.icon && _ctx.icon
|
|
}, !_ctx.$slots.icon && _ctx.icon ? {
|
|
c: common_vendor.p({
|
|
name: _ctx.icon,
|
|
["custom-style"]: common_vendor.unref(textStyle),
|
|
["custom-class"]: `wd-tabbar-item__body-icon ${common_vendor.unref(active) ? "is-active" : "is-inactive"}`
|
|
})
|
|
} : {}, {
|
|
d: _ctx.title
|
|
}, _ctx.title ? {
|
|
e: common_vendor.t(_ctx.title),
|
|
f: common_vendor.s(common_vendor.unref(textStyle)),
|
|
g: common_vendor.n(`wd-tabbar-item__body-title ${common_vendor.unref(active) ? "is-active" : "is-inactive"}`)
|
|
} : {}, {
|
|
h: common_vendor.p({
|
|
...common_vendor.unref(customBadgeProps)
|
|
}),
|
|
i: common_vendor.n(`wd-tabbar-item ${_ctx.customClass}`),
|
|
j: common_vendor.s(_ctx.customStyle),
|
|
k: common_vendor.o(handleClick)
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3d913b93"], ["__file", "D:/\u7F51\u6291\u4E91Time/\u79C1\u6D3B/2000\u7B97\u5366/src/uni_modules/wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue"]]);
|
|
wx.createComponent(Component);
|