custom-tabbar.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const store_message = require("../../store/message.js");
  4. const _sfc_main = {
  5. __name: "custom-tabbar",
  6. props: {
  7. activeIndex: {
  8. type: Number,
  9. default: 0
  10. }
  11. },
  12. setup(__props) {
  13. const props = __props;
  14. const color = common_vendor.ref("#999999");
  15. const selectedColor = common_vendor.ref("#1F6CFF");
  16. const unreadMessageCount = common_vendor.computed(() => store_message.messageStore.unreadCount);
  17. const list = common_vendor.ref([
  18. {
  19. pagePath: "/pages/jobs/jobs",
  20. iconPath: "/static/tabbar/jobs_n.png",
  21. selectedIconPath: "/static/tabbar/jobs_a.png",
  22. text: "岗位"
  23. },
  24. {
  25. pagePath: "/pages/assessment/assessment",
  26. iconPath: "/static/tabbar/assess_n.png",
  27. selectedIconPath: "/static/tabbar/assess_a.png",
  28. text: "测评"
  29. },
  30. {
  31. pagePath: "/pages/message/message",
  32. iconPath: "/static/tabbar/msg_n.png",
  33. selectedIconPath: "/static/tabbar/msg_a.png",
  34. text: "消息"
  35. },
  36. {
  37. pagePath: "/pages/my/my",
  38. iconPath: "/static/tabbar/my_n.png",
  39. selectedIconPath: "/static/tabbar/my_a.png",
  40. text: "我的"
  41. }
  42. ]);
  43. const switchTab = (path, index) => {
  44. if (props.activeIndex !== index) {
  45. common_vendor.index.switchTab({
  46. url: path
  47. });
  48. }
  49. };
  50. common_vendor.onMounted(() => {
  51. common_vendor.index.hideTabBar({
  52. animation: false
  53. });
  54. });
  55. return (_ctx, _cache) => {
  56. return {
  57. a: common_vendor.f(list.value, (item, index, i0) => {
  58. return common_vendor.e({
  59. a: item.pagePath === "/pages/message/message" && unreadMessageCount.value > 0
  60. }, item.pagePath === "/pages/message/message" && unreadMessageCount.value > 0 ? {
  61. b: common_vendor.t(unreadMessageCount.value)
  62. } : {}, {
  63. c: __props.activeIndex === index ? item.selectedIconPath : item.iconPath,
  64. d: common_vendor.t(item.text),
  65. e: __props.activeIndex === index ? selectedColor.value : color.value,
  66. f: index,
  67. g: common_vendor.o(($event) => switchTab(item.pagePath, index), index)
  68. });
  69. })
  70. };
  71. };
  72. }
  73. };
  74. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-51c48e3c"]]);
  75. wx.createComponent(Component);
  76. //# sourceMappingURL=../../../.sourcemap/mp-weixin/components/custom-tabbar/custom-tabbar.js.map