index.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  4. __name: "index",
  5. setup(__props) {
  6. var _a, _b;
  7. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  8. const $config = (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  9. const config = common_vendor.ref({ logoUrl: [] });
  10. common_vendor.ref("");
  11. const LatterName = common_vendor.ref(["全", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]);
  12. const CityList = common_vendor.ref($config.china);
  13. const LetterId = common_vendor.ref("");
  14. common_vendor.onLoad(async () => {
  15. await searchConfig();
  16. await search();
  17. });
  18. const searchConfig = async () => {
  19. config.value = common_vendor.index.getStorageSync("config");
  20. };
  21. const search = async () => {
  22. };
  23. const getLetter = (name) => {
  24. LetterId.value = name;
  25. common_vendor.index.pageScrollTo({
  26. selector: "#" + name,
  27. duration: 300
  28. });
  29. };
  30. const getStorage = (item) => {
  31. common_vendor.index.$emit("toCity", item);
  32. common_vendor.index.navigateBack({
  33. delta: 1
  34. // 返回的页面数
  35. });
  36. };
  37. return (_ctx, _cache) => {
  38. return {
  39. a: common_vendor.o(($event) => getLetter("ScrollTop")),
  40. b: common_vendor.f(LatterName.value, (l, i, i0) => {
  41. return {
  42. a: common_vendor.t(l),
  43. b: i,
  44. c: common_vendor.o(($event) => getLetter(l), i),
  45. d: LetterId.value === l ? "#ffbc00" : "#000"
  46. };
  47. }),
  48. c: common_vendor.f(CityList.value, (item, index, i0) => {
  49. return {
  50. a: common_vendor.t(item.initial),
  51. b: item.initial,
  52. c: common_vendor.f(item.list, (item_city, name_index, i1) => {
  53. return {
  54. a: common_vendor.t(item_city.name),
  55. b: common_vendor.o(($event) => getStorage(item_city), name_index),
  56. c: name_index
  57. };
  58. }),
  59. d: index
  60. };
  61. }),
  62. d: LetterId.value
  63. };
  64. };
  65. }
  66. });
  67. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3361df53"], ["__file", "D:/project/二手车/car_applet/pagesHome/city/index.vue"]]);
  68. wx.createPage(MiniProgramPage);