s-search-block.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../index.js");
  4. require("../../api/index.js");
  5. require("../../api/distri/score.js");
  6. require("../../request/index.js");
  7. require("../../config/index.js");
  8. require("../../store/index.js");
  9. require("../../store/app.js");
  10. require("../../api/promotion/diy.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("../../hooks/useModal.js");
  21. require("../../helper/index.js");
  22. require("../../helper/test.js");
  23. require("../../helper/digit.js");
  24. require("../../api/member/signin.js");
  25. require("../../helper/throttle.js");
  26. require("../../url/index.js");
  27. require("../../platform/pay.js");
  28. require("../../api/pay/order.js");
  29. require("../../store/user.js");
  30. require("../../store/cart.js");
  31. require("../../api/trade/cart.js");
  32. require("../../api/pay/wallet.js");
  33. require("../../api/trade/order.js");
  34. require("../../api/promotion/coupon.js");
  35. require("../../store/sys.js");
  36. require("../../store/modal.js");
  37. require("../../api/distri/share.js");
  38. require("../../api/distri/team.js");
  39. require("../../api/infra/file.js");
  40. require("../../api/member/address.js");
  41. require("../../api/member/point.js");
  42. require("../../api/migration/app.js");
  43. require("../../api/migration/chat.js");
  44. require("../../api/migration/index.js");
  45. require("../../api/migration/third.js");
  46. require("../../api/pay/channel.js");
  47. require("../../api/product/category.js");
  48. require("../../api/product/comment.js");
  49. require("../../api/product/favorite.js");
  50. require("../../api/product/history.js");
  51. require("../../api/product/spu.js");
  52. require("../../api/promotion/activity.js");
  53. require("../../api/promotion/article.js");
  54. require("../../api/promotion/bargain.js");
  55. require("../../api/promotion/combination.js");
  56. require("../../api/promotion/rewardActivity.js");
  57. require("../../api/promotion/seckill.js");
  58. require("../../api/system/area.js");
  59. require("../../api/system/voice.js");
  60. require("../../api/trade/afterSale.js");
  61. require("../../api/trade/brokerage.js");
  62. require("../../api/trade/config.js");
  63. require("../../api/trade/delivery.js");
  64. require("../../config/zIndex.js");
  65. if (!Array) {
  66. const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
  67. _easycom_uni_search_bar2();
  68. }
  69. const _easycom_uni_search_bar = () => "../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
  70. if (!Math) {
  71. _easycom_uni_search_bar();
  72. }
  73. const _sfc_main = {
  74. __name: "s-search-block",
  75. props: {
  76. data: {
  77. type: Object,
  78. default: () => ({})
  79. },
  80. // 输入框背景色
  81. elBackground: {
  82. type: String,
  83. default: ""
  84. },
  85. height: {
  86. type: Number,
  87. default: 36
  88. },
  89. // 图标颜色
  90. iconColor: {
  91. type: String,
  92. default: "#b0b3bf"
  93. },
  94. // 字体颜色
  95. fontColor: {
  96. type: String,
  97. default: "#b0b3bf"
  98. },
  99. // placeholder
  100. placeholder: {
  101. type: String,
  102. default: "这是一个搜索框"
  103. },
  104. radius: {
  105. type: Number,
  106. default: 10
  107. },
  108. width: {
  109. type: String,
  110. default: "100%"
  111. },
  112. navbar: {
  113. type: Boolean,
  114. default: true
  115. }
  116. },
  117. emits: ["click"],
  118. setup(__props, { emit: __emit }) {
  119. const state = common_vendor.reactive({
  120. searchVal: ""
  121. });
  122. const emits = __emit;
  123. const props = __props;
  124. const click = () => {
  125. emits("click");
  126. };
  127. function onSearch(e) {
  128. if (e.value) {
  129. sheep_index.sheep.$router.go("/pages/goods/list", {
  130. keyword: e.value
  131. });
  132. setTimeout(() => {
  133. state.searchVal = "";
  134. }, 100);
  135. }
  136. }
  137. return (_ctx, _cache) => {
  138. return common_vendor.e({
  139. a: __props.navbar
  140. }, __props.navbar ? {
  141. b: common_vendor.s({
  142. color: props.iconColor
  143. }),
  144. c: common_vendor.t(__props.placeholder),
  145. d: common_vendor.s({
  146. color: __props.fontColor,
  147. width: __props.width
  148. })
  149. } : {}, {
  150. e: !__props.navbar
  151. }, !__props.navbar ? {
  152. f: common_vendor.o(onSearch),
  153. g: common_vendor.o(($event) => state.searchVal = $event),
  154. h: common_vendor.p({
  155. radius: __props.data.borderRadius,
  156. placeholder: __props.data.placeholder,
  157. cancelButton: "none",
  158. clearButton: "none",
  159. modelValue: state.searchVal
  160. })
  161. } : {}, {
  162. i: common_vendor.f(__props.data.hotKeywords, (item, index, i0) => {
  163. return {
  164. a: common_vendor.t(item),
  165. b: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/list", {
  166. keyword: item
  167. }), index),
  168. c: index
  169. };
  170. }),
  171. j: common_vendor.s({
  172. color: __props.data.textColor
  173. }),
  174. k: __props.data.hotKeywords && __props.data.hotKeywords.length && __props.navbar
  175. }, __props.data.hotKeywords && __props.data.hotKeywords.length && __props.navbar ? {
  176. l: common_vendor.f(__props.data.hotKeywords, (item, index, i0) => {
  177. return {
  178. a: common_vendor.t(item),
  179. b: index
  180. };
  181. }),
  182. m: common_vendor.s({
  183. color: __props.data.textColor,
  184. marginRight: "10rpx"
  185. })
  186. } : {}, {
  187. n: common_vendor.o(click),
  188. o: common_vendor.s({
  189. borderRadius: __props.radius + "px",
  190. background: __props.elBackground,
  191. height: __props.height + "px",
  192. width: __props.width
  193. }),
  194. p: common_vendor.n({
  195. "border-content": __props.navbar
  196. })
  197. });
  198. };
  199. }
  200. };
  201. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1f3fe5bf"], ["__file", "D:/zx/mall-front-app/sheep/components/s-search-block/s-search-block.vue"]]);
  202. wx.createComponent(Component);