C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

102 行
1.8 KiB

  1. // components/dateLsit/dateLsit.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. week:['日','一','二','三','四','五','六'],
  8. dateLsit:[],
  9. year: new Date().getFullYear(),
  10. month: new Date().getMonth()+1,
  11. },
  12. showDate(){//刷新日历
  13. let thenDey = this.getThenWeek()
  14. },
  15. getDays(year, month){//获取每月有多少天
  16. let tempDateArr = []
  17. let thenDate = new Date(year, month, 0).getDate()
  18. return thenDate
  19. },
  20. getLastMonth(year, month){//上一个月最后一天是多少号
  21. if(month==1){
  22. month =12
  23. year = year-1
  24. }else{
  25. month = month-1
  26. }
  27. let tempDateArr = []
  28. let thenDate = new Date(year, month, 0).getDate()
  29. return thenDate
  30. },
  31. getThenWeek(year, month){//获取每个月第一天是星期几
  32. if (month == 1) {
  33. month = 12
  34. year = year - 1
  35. } else {
  36. month = month - 1
  37. }
  38. let date = new Date()
  39. date.setFullYear(year)
  40. date.setMonth(month)
  41. date.setDate(1)
  42. return date.getDay()
  43. },
  44. /**
  45. * 生命周期函数--监听页面加载
  46. */
  47. onLoad: function (options) {
  48. console.log(this.getThenWeek(2021,3))
  49. },
  50. /**
  51. * 生命周期函数--监听页面初次渲染完成
  52. */
  53. onReady: function () {
  54. },
  55. /**
  56. * 生命周期函数--监听页面显示
  57. */
  58. onShow: function () {
  59. },
  60. /**
  61. * 生命周期函数--监听页面隐藏
  62. */
  63. onHide: function () {
  64. },
  65. /**
  66. * 生命周期函数--监听页面卸载
  67. */
  68. onUnload: function () {
  69. },
  70. /**
  71. * 页面相关事件处理函数--监听用户下拉动作
  72. */
  73. onPullDownRefresh: function () {
  74. },
  75. /**
  76. * 页面上拉触底事件的处理函数
  77. */
  78. onReachBottom: function () {
  79. },
  80. /**
  81. * 用户点击右上角分享
  82. */
  83. onShareAppMessage: function () {
  84. }
  85. })