55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = {
|
|
name: "BottomNav",
|
|
props: {
|
|
navItems: {
|
|
type: Array,
|
|
default: () => ["首页", "申请租赁", "个人中心"]
|
|
},
|
|
activeIndex: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
iconConfig: {
|
|
type: Object,
|
|
required: true
|
|
}
|
|
},
|
|
methods: {
|
|
onNavClick(index) {
|
|
this.$emit("nav-click", index);
|
|
},
|
|
getNavIcon(index) {
|
|
const isActive = index === this.activeIndex;
|
|
const icons = this.iconConfig;
|
|
switch (index) {
|
|
case 0:
|
|
return isActive ? icons.HOME_ACTIVE : icons.HOME;
|
|
case 1:
|
|
return isActive ? icons.RENT_ACTIVE : icons.RENT;
|
|
case 2:
|
|
return isActive ? icons.PERSONAL_CENTER_ACTIVE : icons.PERSONAL_CENTER;
|
|
default:
|
|
return icons.HOME;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.f($props.navItems, (nav, index, i0) => {
|
|
return {
|
|
a: $options.getNavIcon(index),
|
|
b: common_vendor.t(nav),
|
|
c: index,
|
|
d: index === $props.activeIndex ? 1 : "",
|
|
e: common_vendor.o(($event) => $options.onNavClick(index), index)
|
|
};
|
|
})
|
|
};
|
|
}
|
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-55d8123a"]]);
|
|
wx.createComponent(Component);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/bottom-nav/bottom-nav.js.map
|