You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.2KB

  1. // pages/givePage/givePage.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. buyNumber: 1,
  8. num: 1,
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: function (options) {
  14. },
  15. /**
  16. * 生命周期函数--监听页面初次渲染完成
  17. */
  18. onReady: function () {
  19. },
  20. /**
  21. * 生命周期函数--监听页面显示
  22. */
  23. onShow: function () {
  24. },
  25. /**
  26. * 生命周期函数--监听页面隐藏
  27. */
  28. onHide: function () {
  29. },
  30. /**
  31. * 生命周期函数--监听页面卸载
  32. */
  33. onUnload: function () {
  34. },
  35. /**
  36. * 页面相关事件处理函数--监听用户下拉动作
  37. */
  38. onPullDownRefresh: function () {
  39. },
  40. /**
  41. * 页面上拉触底事件的处理函数
  42. */
  43. onReachBottom: function () {
  44. },
  45. /**
  46. * 用户点击右上角分享
  47. */
  48. onShareAppMessage: function () {
  49. },
  50. addFn: function () {
  51. if (this.data.num < 5) {
  52. this.data.num++;
  53. this.setData({
  54. buyNumber: this.data.num
  55. })
  56. }
  57. },
  58. subtractFn: function () {
  59. if (this.data.num > 1) {
  60. this.data.num--;
  61. this.setData({
  62. buyNumber: this.data.num
  63. })
  64. }
  65. },
  66. })