更改element-ui的日历组件--支持点击--样式修改--悬浮数据

  • 原样式在这里插入图片描述
  • 修改以后
    在这里插入图片描述
  <el-calendar v-model="value">
            <template slot="dateCell" slot-scope="{date, data}">
              <el-popover popper-class="popoverBackB" placement="top" @show="handerShow(date, data)" width="200" trigger="hover" :content="dateText">
                <div class="calendar-day" slot="reference" @click="clickData">{{ data.day.split('-').slice(2).join('-') }}</div>
              </el-popover>
            </template>

 </el-calendar>


 data() {
    return {
      value: new Date(),
    }
  }    

+ 方法

    handerShow(date, data) {
      this.dataDay = data.day
      appointMessage({ date: data.day }).then(res => {
        if (res.data) {
          this.dateText = `今日预约数${res.data}`
        } else {
          this.dateText = '没有数据'
        }
      })
      // console.log(date, data);
    },

   clickData() {
      // console.log(111);
      this.$router.push({
        path: '/customercenter/reserverecord',
        query: {
          currentTab: 1,
          comeDate: this.dataDay
        }
      })
    },
  • 样式
/deep/ {
  .el-calendar-table .el-calendar-day {
    height: 52px;
    text-align: center;
    line-height: 36px;
  }
  .el-calendar-table__row td {
    border: 0;
    border-radius: 50%;
  }
  .el-calendar-table tbody {
    border-left: 1px solid red !important;
  }
  .el-calendar-table tr td:first-child {
    border: none;
  }
  .el-calendar-table tr:first-child td {
    border: none;
  }
  .el-calendar-table td.is-selected {
    background-color: #2c51ef;
    color: #fff;
  }
  .el-calendar-table td.is-selected {
    border-radius: 50%;
  }
  .el-calendar-table .el-calendar-day:hove {
    border-radius: 50%;
    background-color: #2c51ef !important;
    color: #fff;
  }
  .el-calendar-table .el-calendar-day:hover {
    border-radius: 50%;
    color: #fff;
    background-color: #2c51ef !important;
  }
  .el-calendar-table thead th:before {
    content: "周";
  }
}

可以的大家点点关注-总结不易谢谢大家-也可以留言需要哪类的我也可以尝试

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值