navbar.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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("../../../helper/throttle.js");
  24. require("../../../platform/pay.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. if (!Array) {
  36. const _easycom_su_status_bar2 = common_vendor.resolveComponent("su-status-bar");
  37. const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
  38. (_easycom_su_status_bar2 + _easycom_su_fixed2)();
  39. }
  40. const _easycom_su_status_bar = () => "../../../ui/su-status-bar/su-status-bar.js";
  41. const _easycom_su_fixed = () => "../../../ui/su-fixed/su-fixed.js";
  42. if (!Math) {
  43. (_easycom_su_status_bar + _easycom_su_fixed)();
  44. }
  45. const _sfc_main = {
  46. __name: "navbar",
  47. props: {
  48. sticky: Boolean,
  49. zIndex: {
  50. type: Number,
  51. default: 100
  52. },
  53. back: {
  54. //是否返回上一页
  55. type: Boolean,
  56. default: true
  57. },
  58. backtext: {
  59. //返回文本
  60. type: String,
  61. default: ""
  62. },
  63. bg: {
  64. type: String,
  65. default: "bg-white"
  66. },
  67. status: {
  68. //状态栏颜色 可以选择light dark/其他字符串视为黑色
  69. type: String,
  70. default: ""
  71. },
  72. // 常驻
  73. alway: {
  74. type: Boolean,
  75. default: true
  76. },
  77. opacity: {
  78. //是否开启滑动渐变
  79. type: Boolean,
  80. default: false
  81. },
  82. opacityBg: {
  83. //开启滑动渐变后 返回按钮是否添加背景
  84. type: Boolean,
  85. default: false
  86. },
  87. noFixed: {
  88. //是否浮动
  89. type: Boolean,
  90. default: false
  91. },
  92. ui: {
  93. type: String,
  94. default: ""
  95. },
  96. capsule: {
  97. //是否开启胶囊返回
  98. type: Boolean,
  99. default: false
  100. },
  101. stopBack: {
  102. type: Boolean,
  103. default: false
  104. },
  105. placeholder: {
  106. type: [Boolean],
  107. default: true
  108. },
  109. bgStyles: {
  110. type: Object,
  111. default() {
  112. }
  113. }
  114. },
  115. emits: ["navback"],
  116. setup(__props, { emit: emits }) {
  117. const props = __props;
  118. const state = common_vendor.reactive({
  119. statusCur: "",
  120. capsuleStyle: {},
  121. capsuleBack: {}
  122. });
  123. const sys_statusBar = sheep_index.sheep.$platform.device.statusBarHeight;
  124. const sys_navBar = sheep_index.sheep.$platform.navbar;
  125. common_vendor.onBeforeMount(() => {
  126. init();
  127. });
  128. const init = () => {
  129. state.capsuleStyle = {
  130. width: sheep_index.sheep.$platform.capsule.width + "px",
  131. height: sheep_index.sheep.$platform.capsule.height + "px",
  132. margin: "0 " + (sheep_index.sheep.$platform.device.windowWidth - sheep_index.sheep.$platform.capsule.right) + "px"
  133. };
  134. state.capsuleBack = state.capsuleStyle;
  135. };
  136. return (_ctx, _cache) => {
  137. return {
  138. a: common_vendor.s(state.capsuleStyle),
  139. b: common_vendor.n(props.status == "" ? `text-a` : props.status == "light" ? "text-white" : "text-black"),
  140. c: common_vendor.s({
  141. height: common_vendor.unref(sys_navBar) - common_vendor.unref(sys_statusBar) + "px"
  142. }),
  143. d: common_vendor.p({
  144. noFixed: props.noFixed,
  145. alway: props.alway,
  146. bgStyles: props.bgStyles,
  147. val: 0,
  148. index: props.zIndex,
  149. noNav: true,
  150. bg: props.bg,
  151. ui: props.ui,
  152. opacity: props.opacity,
  153. placeholder: props.placeholder,
  154. sticky: props.sticky
  155. })
  156. };
  157. };
  158. }
  159. };
  160. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-81e1f503"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/sheep/components/s-custom-navbar/components/navbar.vue"]]);
  161. wx.createComponent(Component);