antd日历实现待办标记

1.

<a-calendar :fullscreen="false" :header-render="headerRender" @panelChange="onPanelChange" @select="onSelect">
                  <ul slot="dateCellRender" slot-scope="value" class="events">
                    <li v-for="item in getListData(value)" :key="item.content">
                      <a-badge :status="item.type" :number-style="{float:'right',marginTop:'-50px',marginRight:'-13px'}" />
                    </li>
                  </ul>
                </a-calendar>

2.

getListData(value) {
            let listData;
            //遍历数组
            
            this.beDate.forEach(e => {
            //让数组的date与遍历到日历的那天的日期值相匹配
              if (e.date === value.format("YYYY-MM-DD")) {
                listData = e.listData;
              }
            });
            return listData || [];
            
          },

3.

.events {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .events .ant-badge-status {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    text-overflow: ellipsis;
    font-size: 12px;
  }
  .notes-month {
    text-align: center;
    font-size: 28px;
  }
  .notes-month section {
    font-size: 28px;
  }

 ps:(数据格式)

[
                {
                  date: "2022-07-11",
                  listData: [{ type: "warning" }],
                },
                {
                  date: "2022-07-05",
                  listData: [{ type: "warning"}],
                },
                {
                  date: "2022-07-08",
                   listData: [{ type: "warning"}],
                },
              ],

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值