s-tabbar.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../index.js");
  4. require("../../url/index.js");
  5. require("../../store/index.js");
  6. require("../../store/app.js");
  7. require("../../api/promotion/diy.js");
  8. require("../../request/index.js");
  9. require("../../config/index.js");
  10. require("../../platform/index.js");
  11. require("../../platform/provider/wechat/index.js");
  12. require("../../platform/provider/wechat/miniProgram.js");
  13. require("../../api/member/auth.js");
  14. require("../../api/member/social.js");
  15. require("../../api/member/user.js");
  16. require("../../platform/provider/apple/index.js");
  17. require("../../platform/share.js");
  18. require("../../router/index.js");
  19. require("../../hooks/useModal.js");
  20. require("../../helper/index.js");
  21. require("../../helper/test.js");
  22. require("../../helper/digit.js");
  23. require("../../api/member/signin.js");
  24. require("../../helper/throttle.js");
  25. require("../../platform/pay.js");
  26. require("../../api/pay/order.js");
  27. require("../../store/user.js");
  28. require("../../store/cart.js");
  29. require("../../api/trade/cart.js");
  30. require("../../api/pay/wallet.js");
  31. require("../../api/trade/order.js");
  32. require("../../api/promotion/coupon.js");
  33. require("../../store/sys.js");
  34. require("../../store/modal.js");
  35. require("../../config/zIndex.js");
  36. if (!Array) {
  37. const _easycom_su_tabbar_item2 = common_vendor.resolveComponent("su-tabbar-item");
  38. const _easycom_su_tabbar2 = common_vendor.resolveComponent("su-tabbar");
  39. (_easycom_su_tabbar_item2 + _easycom_su_tabbar2)();
  40. }
  41. const _easycom_su_tabbar_item = () => "../../ui/su-tabbar-item/su-tabbar-item.js";
  42. const _easycom_su_tabbar = () => "../../ui/su-tabbar/su-tabbar.js";
  43. if (!Math) {
  44. (_easycom_su_tabbar_item + _easycom_su_tabbar)();
  45. }
  46. const _sfc_main = {
  47. __name: "s-tabbar",
  48. props: {
  49. path: String,
  50. default: ""
  51. },
  52. setup(__props) {
  53. const tabbar = common_vendor.computed(() => {
  54. var _a;
  55. return (_a = sheep_index.sheep.$store("app").template.basic) == null ? void 0 : _a.tabbar;
  56. });
  57. const tabbarStyle = common_vendor.computed(() => {
  58. const backgroundStyle = tabbar.value.style;
  59. if (backgroundStyle.bgType === "color") {
  60. return { background: backgroundStyle.bgColor };
  61. }
  62. if (backgroundStyle.bgType === "img")
  63. return {
  64. background: `url(${sheep_index.sheep.$url.cdn(
  65. backgroundStyle.bgImg
  66. )}) no-repeat top center / 100% auto`
  67. };
  68. });
  69. const getTabbarCenter = (index) => {
  70. if (common_vendor.unref(tabbar).mode !== 2)
  71. return false;
  72. return common_vendor.unref(tabbar).items % 2 > 0 ? Math.ceil(common_vendor.unref(tabbar).items.length / 2) === index + 1 : false;
  73. };
  74. return (_ctx, _cache) => {
  75. var _a, _b, _c, _d;
  76. return common_vendor.e({
  77. a: ((_b = (_a = tabbar.value) == null ? void 0 : _a.items) == null ? void 0 : _b.length) > 0
  78. }, ((_d = (_c = tabbar.value) == null ? void 0 : _c.items) == null ? void 0 : _d.length) > 0 ? {
  79. b: common_vendor.f(tabbar.value.items, (item, index, i0) => {
  80. return {
  81. a: common_vendor.unref(sheep_index.sheep).$url.cdn(item.activeIconUrl),
  82. b: common_vendor.unref(sheep_index.sheep).$url.cdn(item.iconUrl),
  83. c: item.text,
  84. d: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go(item.url), item.text),
  85. e: "2c28bd42-1-" + i0 + ",2c28bd42-0",
  86. f: common_vendor.p({
  87. text: item.text,
  88. name: item.url,
  89. isCenter: getTabbarCenter(index),
  90. centerImage: common_vendor.unref(sheep_index.sheep).$url.cdn(item.iconUrl)
  91. })
  92. };
  93. }),
  94. c: common_vendor.p({
  95. value: __props.path,
  96. fixed: true,
  97. placeholder: true,
  98. safeAreaInsetBottom: true,
  99. inactiveColor: tabbar.value.style.color,
  100. activeColor: tabbar.value.style.activeColor,
  101. midTabBar: tabbar.value.mode === 2,
  102. customStyle: tabbarStyle.value
  103. })
  104. } : {});
  105. };
  106. }
  107. };
  108. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/zx/mall-front-app/sheep/components/s-tabbar/s-tabbar.vue"]]);
  109. wx.createComponent(Component);