美文网首页
微信小程序 vant日历自定义文案

微信小程序 vant日历自定义文案

作者: 安徒生1997 | 来源:发表于2021-04-25 13:17 被阅读0次


1.wxml

<van-calendar

      poppable="{{ false }}"

      show-confirm="{{ false }}"

      formatter="{{ formatter }}"

      class="calendar"

      show-title="{{ false }}"

      show-subtitle="{{ false }}"

    >

    </van-calendar>

2.js:

onLoad(options){

    this.CalendarShow();

}

CalendarShow() {

    let _this=this;

    var data = {};

    data.formatter = this.dayFormatter;

      // 渲染日历

    this.setData({formatter: function (day) {

        let month = day.date.getMonth() + 1;

        let date = day.date.getDate();

        for(let i of list){

          if(month ===i.month){

            if (date === i.day) {

              day.bottomInfo = '余票'+i.stock+'张';

            }

          }

        };

        return day;

      } })

  },

相关文章

网友评论

      本文标题:微信小程序 vant日历自定义文案

      本文链接:https://www.haomeiwen.com/subject/fjsdrltx.html