关于微信小程序日历插件的使用及步骤

关于微信小程序日历插件的使用及步骤

  1. 在微信小程序管理后台——设置——第三方服务,按 AppID(wx92c68dae5a8bb046)搜索到该插件并申请授权。
  2. 在当前小程序的app.json文件中配置插件信息在这里插入图片描述
  3. 然后在使用该插件的json文件中配置在这里插入图片描述
  4. 在wxml中引入该插件
    在这里插入图片描述
    5js文件
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  },  


  onShow: function () {
    var me = this 
    let demo1_days_style = new Array;
    demo1_days_style.push({
      month: 'current', day: 10, color: 'red', background:'yellow'
    });
    // demo1_days_style.push({
    //   month: 'current', day: 20, color: 'blue', background: 'purple'
    // });
    me.setData({
      style: demo1_days_style
    })
    console.log(me.data.style,'____')
  },
  dayClick: function(e){
    console.log(e.detail)
  },
  // 监听下个月点击事件
  next:function(e){
    console.log(e.detail,"++++")
    var me = this 
    let nextMonth = new Array();
    nextMonth.push({
      month: 'current', day: 20, color: 'blue', background: 'purple'
    })
    me.data.style = ''
    me.setData({
      style: nextMonth
    })
  },
  // 监听上个月的点击事件
  prev: function(e){
    var  me = this ;
    let prevMonth = new Array();
    prevMonth.push({
      month:  'current', day: 10, color: 'red', background: 'yellow'
    })
    me.data.style = ''
    me.setData({
      style: prevMonth
    })
  },
  dateChange: function (event) {//监听点击日历标题日期选择器事件
    console.log(event.detail);
  },
})

补充:客户端可以手动更改日历初始月份,也可以根据服务器端需要更改月份,如果需要在每月显示不同状态的内容,即可以像style数组中添加多个对应状态对象,用户也可以在开发工具的wxml中找到日历对应节点及class属性,在wxss中来修改日历样式在这里插入图片描述

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值