addAddress.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // pages/addAddress/addAddress.js
  2. const date = new Date()
  3. const years = []
  4. const months = []
  5. const days = []
  6. for (let i = 1990; i <= date.getFullYear(); i++) {
  7. years.push(i)
  8. }
  9. for (let i = 1; i <= 12; i++) {
  10. months.push(i)
  11. }
  12. for (let i = 1; i <= 31; i++) {
  13. days.push(i)
  14. }
  15. const getReq = require('./../../config.js').getReq
  16. Page({
  17. /**
  18. * 页面的初始数据
  19. */
  20. data: {
  21. checked: true,
  22. areas: [],
  23. region: [],
  24. years: years,
  25. year: date.getFullYear(),
  26. months: months,
  27. month: 2,
  28. days: days,
  29. day: 2,
  30. value: [9999, 1, 1]
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {
  36. },
  37. toggleChecked() {
  38. this.setData({
  39. checked: !this.data.checked
  40. })
  41. },
  42. bindRegionChange: function (e) {
  43. // console.log('picker发送选择改变,携带值为', e.detail.value)
  44. this.setData({
  45. region: e.detail.value
  46. })
  47. },
  48. bindChange: function (e) {
  49. const val = e.detail.value
  50. this.setData({
  51. year: this.data.years[val[0]],
  52. month: this.data.months[val[1]],
  53. day: this.data.days[val[2]]
  54. })
  55. },
  56. /**
  57. * 生命周期函数--监听页面初次渲染完成
  58. */
  59. onReady: function () {
  60. },
  61. /**
  62. * 生命周期函数--监听页面显示
  63. */
  64. onShow: function () {
  65. },
  66. /**
  67. * 生命周期函数--监听页面隐藏
  68. */
  69. onHide: function () {
  70. },
  71. /**
  72. * 生命周期函数--监听页面卸载
  73. */
  74. onUnload: function () {
  75. },
  76. /**
  77. * 页面相关事件处理函数--监听用户下拉动作
  78. */
  79. onPullDownRefresh: function () {
  80. },
  81. /**
  82. * 页面上拉触底事件的处理函数
  83. */
  84. onReachBottom: function () {
  85. },
  86. /**
  87. * 用户点击右上角分享
  88. */
  89. onShareAppMessage: function () {
  90. }
  91. })