index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const utils_file = require("../../utils/file.js");
  4. const _sfc_main = {
  5. __name: "index",
  6. setup(__props) {
  7. const quantity = common_vendor.ref(1);
  8. const handleIncrease = () => {
  9. if (quantity.value >= 99)
  10. return;
  11. quantity.value++;
  12. };
  13. const handleDecrease = () => {
  14. if (quantity.value > 0) {
  15. quantity.value--;
  16. }
  17. };
  18. const handleAddToCart = () => {
  19. common_vendor.index.__f__("log", "at pages/foodDetail/index.vue:91", "加入购物车,数量:", quantity.value);
  20. common_vendor.index.navigateBack();
  21. common_vendor.index.showToast({
  22. title: "加入购物车成功",
  23. icon: "none"
  24. });
  25. };
  26. common_vendor.onLoad((e) => {
  27. });
  28. return (_ctx, _cache) => {
  29. return {
  30. a: common_vendor.unref(utils_file.getFileUrl)("/static/demo.png"),
  31. b: common_vendor.unref(utils_file.getFileUrl)("/static/demo.png"),
  32. c: common_vendor.unref(utils_file.getFileUrl)("/static/demo.png"),
  33. d: common_vendor.unref(utils_file.getFileUrl)("img/icon/star.png"),
  34. e: common_vendor.unref(utils_file.getFileUrl)("img/icon/reduce1.png"),
  35. f: quantity.value == 0,
  36. g: common_vendor.unref(utils_file.getFileUrl)("img/icon/reduce2.png"),
  37. h: quantity.value != 0,
  38. i: quantity.value === 0 ? 1 : "",
  39. j: common_vendor.o(handleDecrease),
  40. k: common_vendor.t(quantity.value || 0),
  41. l: common_vendor.unref(utils_file.getFileUrl)("img/icon/add2.png"),
  42. m: quantity.value < 99,
  43. n: common_vendor.unref(utils_file.getFileUrl)("img/icon/add1.png"),
  44. o: quantity.value >= 99,
  45. p: common_vendor.o(handleIncrease),
  46. q: common_vendor.o(handleAddToCart)
  47. };
  48. };
  49. }
  50. };
  51. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e0bb3f86"]]);
  52. wx.createPage(MiniProgramPage);
  53. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/foodDetail/index.js.map