index.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. searchText: "",
  7. results: []
  8. };
  9. },
  10. methods: {
  11. onSearch() {
  12. if (this.searchText) {
  13. this.results = [
  14. { id: 1, title: "示例课程A", desc: "课程描述A" },
  15. { id: 2, title: "示例课程B", desc: "课程描述B" }
  16. ];
  17. } else {
  18. this.results = [];
  19. }
  20. }
  21. }
  22. };
  23. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  24. return common_vendor.e({
  25. a: common_vendor.o((...args) => $options.onSearch && $options.onSearch(...args)),
  26. b: $data.searchText,
  27. c: common_vendor.o(($event) => $data.searchText = $event.detail.value),
  28. d: common_vendor.o((...args) => $options.onSearch && $options.onSearch(...args)),
  29. e: $data.results.length
  30. }, $data.results.length ? {
  31. f: common_vendor.f($data.results, (item, k0, i0) => {
  32. return {
  33. a: common_vendor.t(item.title),
  34. b: common_vendor.t(item.desc),
  35. c: item.id
  36. };
  37. })
  38. } : {});
  39. }
  40. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2dab939d"]]);
  41. wx.createPage(MiniProgramPage);
  42. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/search/index.js.map