s-custom-navbar.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../index.js");
  4. const sheep_hooks_useModal = require("../../hooks/useModal.js");
  5. require("../../url/index.js");
  6. require("../../store/index.js");
  7. require("../../store/app.js");
  8. require("../../api/promotion/diy.js");
  9. require("../../request/index.js");
  10. require("../../config/index.js");
  11. require("../../platform/index.js");
  12. require("../../platform/provider/wechat/index.js");
  13. require("../../platform/provider/wechat/miniProgram.js");
  14. require("../../api/member/auth.js");
  15. require("../../api/member/social.js");
  16. require("../../api/member/user.js");
  17. require("../../platform/provider/apple/index.js");
  18. require("../../platform/share.js");
  19. require("../../router/index.js");
  20. require("../../helper/throttle.js");
  21. require("../../platform/pay.js");
  22. require("../../helper/index.js");
  23. require("../../helper/test.js");
  24. require("../../helper/digit.js");
  25. require("../../api/pay/order.js");
  26. require("../../store/user.js");
  27. require("../../store/cart.js");
  28. require("../../api/trade/cart.js");
  29. require("../../api/pay/wallet.js");
  30. require("../../api/trade/order.js");
  31. require("../../api/promotion/coupon.js");
  32. require("../../store/sys.js");
  33. require("../../store/modal.js");
  34. require("../../config/zIndex.js");
  35. require("../../api/member/signin.js");
  36. if (!Math) {
  37. (NavbarItem + Navbar)();
  38. }
  39. const Navbar = () => "./components/navbar.js";
  40. const NavbarItem = () => "./components/navbar-item.js";
  41. const _sfc_main = {
  42. __name: "s-custom-navbar",
  43. props: {
  44. data: {
  45. type: Object,
  46. default: () => ({})
  47. },
  48. showLeftButton: {
  49. type: Boolean,
  50. default: false
  51. }
  52. },
  53. setup(__props) {
  54. const props = __props;
  55. const hasHistory = sheep_index.sheep.$router.hasHistory();
  56. const sticky = common_vendor.computed(() => {
  57. if (props.data.mode == "inner") {
  58. if (props.data.alway) {
  59. return false;
  60. }
  61. }
  62. if (props.data.mode == "normal") {
  63. return false;
  64. }
  65. });
  66. const navList = common_vendor.computed(() => {
  67. if (!props.data.list)
  68. return [];
  69. return props.data.list.mp;
  70. });
  71. const windowWidth = sheep_index.sheep.$platform.device.windowWidth;
  72. const cell = common_vendor.computed(() => {
  73. if (common_vendor.unref(navList).length) {
  74. let cell2 = (windowWidth - 90) / 8;
  75. cell2 = (windowWidth - 80 - common_vendor.unref(sheep_index.sheep.$platform.capsule).width) / 6;
  76. return cell2;
  77. }
  78. });
  79. const parseImgStyle = (item) => {
  80. let obj = {
  81. width: item.width * cell.value + (item.width - 1) * 10 + "px",
  82. left: item.left * cell.value + (item.left + 1) * 10 + "px",
  83. "border-radius": item.borderRadius + "px"
  84. };
  85. return obj;
  86. };
  87. const isAlway = common_vendor.computed(
  88. () => props.data.mode === "inner" ? Boolean(props.data.alwaysShow) : true
  89. );
  90. const isOpacity = common_vendor.computed(
  91. () => props.data.mode === "normal" ? false : props.showLeftButton ? false : props.data.mode === "inner"
  92. );
  93. const isPlaceholder = common_vendor.computed(() => props.data.mode === "normal");
  94. const bgStyles = common_vendor.computed(() => {
  95. if (props.data.type) {
  96. return {
  97. background: props.data.type == "color" ? props.data.color : `url(${sheep_index.sheep.$url.cdn(props.data.src)}) no-repeat top center / 100% 100%`
  98. };
  99. }
  100. });
  101. function onClickLeft() {
  102. if (hasHistory) {
  103. sheep_index.sheep.$router.back();
  104. } else {
  105. sheep_index.sheep.$router.go("/pages/index/index");
  106. }
  107. }
  108. function onClickRight() {
  109. sheep_hooks_useModal.showMenuTools();
  110. }
  111. return (_ctx, _cache) => {
  112. return common_vendor.e({
  113. a: __props.showLeftButton
  114. }, __props.showLeftButton ? common_vendor.e({
  115. b: common_vendor.unref(hasHistory)
  116. }, common_vendor.unref(hasHistory) ? {} : {}, {
  117. c: common_vendor.o(onClickLeft),
  118. d: common_vendor.o(onClickRight),
  119. e: __props.data.mode == "inner" ? 1 : ""
  120. }) : {}, {
  121. f: common_vendor.f(navList.value, (item, index, i0) => {
  122. return {
  123. a: "6417c6b5-1-" + i0 + ",6417c6b5-0",
  124. b: common_vendor.p({
  125. data: item,
  126. width: parseImgStyle(item).width
  127. }),
  128. c: index,
  129. d: common_vendor.s(parseImgStyle(item)),
  130. e: common_vendor.n({
  131. "ss-flex ss-col-center ss-row-center": item.type !== "search"
  132. })
  133. };
  134. }),
  135. g: common_vendor.p({
  136. alway: isAlway.value,
  137. back: false,
  138. bg: "",
  139. placeholder: isPlaceholder.value,
  140. bgStyles: bgStyles.value,
  141. opacity: isOpacity.value,
  142. sticky: sticky.value
  143. })
  144. });
  145. };
  146. }
  147. };
  148. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6417c6b5"], ["__file", "D:/zx/mall-front-app/sheep/components/s-custom-navbar/s-custom-navbar.vue"]]);
  149. wx.createComponent(Component);