notes.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. const getRandomImage = (seed) => {
  6. return `https://picsum.photos/seed/${seed}/200/300`;
  7. };
  8. return {
  9. noteList: [
  10. {
  11. id: 1,
  12. title: "西游记",
  13. cover: getRandomImage("notes1"),
  14. noteCount: 3
  15. },
  16. {
  17. id: 2,
  18. title: "孝经 (中华经典诵读)",
  19. cover: getRandomImage("notes2"),
  20. noteCount: 10
  21. },
  22. {
  23. id: 3,
  24. title: "西游记",
  25. cover: getRandomImage("notes3"),
  26. noteCount: 4
  27. },
  28. {
  29. id: 4,
  30. title: "孝经 (中华经典诵读)",
  31. cover: getRandomImage("notes4"),
  32. noteCount: 10
  33. },
  34. {
  35. id: 5,
  36. title: "红楼梦",
  37. cover: getRandomImage("notes5"),
  38. noteCount: 5
  39. },
  40. {
  41. id: 6,
  42. title: "三国演义",
  43. cover: getRandomImage("notes6"),
  44. noteCount: 8
  45. }
  46. ]
  47. };
  48. },
  49. onLoad() {
  50. this.loadNotes();
  51. },
  52. methods: {
  53. goBack() {
  54. common_vendor.index.navigateBack();
  55. },
  56. goToBookNotes(item) {
  57. common_vendor.index.navigateTo({
  58. url: `/pages/book-notes/book-notes?bookId=${item.id}&title=${encodeURIComponent(item.title)}&cover=${encodeURIComponent(item.cover)}`
  59. });
  60. },
  61. loadNotes() {
  62. }
  63. }
  64. };
  65. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  66. return common_vendor.e({
  67. a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  68. b: common_vendor.f($data.noteList, (item, index, i0) => {
  69. return {
  70. a: item.cover,
  71. b: common_vendor.t(item.title),
  72. c: common_vendor.t(item.noteCount),
  73. d: index,
  74. e: common_vendor.o(($event) => $options.goToBookNotes(item), index)
  75. };
  76. }),
  77. c: $data.noteList.length === 0
  78. }, $data.noteList.length === 0 ? {} : {});
  79. }
  80. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cc7fb8d7"]]);
  81. wx.createPage(MiniProgramPage);
  82. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/notes/notes.js.map