elementUI日历组件标注周六周日

<template>
  <el-calendar v-model="value">
    <template slot="dateCell" slot-scope="{ date, data }">
      <div class="date-content">
        <span class="text">{
  { getDay(date) }}</span>
        <span v-if="getWeek(date)" class="week">休</span>
      </div>
    </template>
  </el-calendar>
</template>

<script>
export default {
  data() {
    return {
      value: new Date()
    }
  },
  methods: {
    // 标注今天
    getDay(date) {
      return date.getDate()
    },
    // 标注周六日
    getWeek(date) {
      return date.getDay() === 6 || date.getDay() === 0
    }
  }
}
</script>

<style lang="scss" scoped>
.select-box {
  display: flex;
  justify-content: flex-end;
}

::v-deep .el-calendar-day {
  height:  auto;
 }
::v-deep .el-calendar-table__row td::v-deep .el-calendar-table tr td:first-child, ::v-deep .el-calendar-table__row td.prev{
  border:none;
 }
.date-content {
  height: 40px;
  text-align: center;
  line-height: 40px;
  font-size: 14px;
}
.date-content .week {
  color: #fff;
  border-radius: 50%;
  background: rgb(250, 124, 77);
  width: 20px;
  height: 20px;
  line-height: 20px;
  display: inline-block;
  font-size: 12px;
  margin-left: 10px;
}
.date-content .text{
  width: 20px;
  height: 20px;
  line-height: 20px;
 display: inline-block;

}
::v-deep .el-calendar-table td.is-selected .text{
   background: #409eff;
   color: #fff;
   border-radius: 50%;
 }
::v-deep .el-calendar__header {
   display: none
 }
</style>

相关推荐

  1. 生命周期标注

    2023-12-27 15:40:03       38 阅读
  2. vue父子组件生命周期

    2023-12-27 15:40:03       18 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-27 15:40:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-27 15:40:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-27 15:40:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-27 15:40:03       18 阅读

热门阅读

  1. LeetCode-23 合并 K 个升序链表

    2023-12-27 15:40:03       42 阅读
  2. SQL面试题挑战08:补全缺失日的月销售累计

    2023-12-27 15:40:03       41 阅读
  3. 初识k8s

    初识k8s

    2023-12-27 15:40:03      37 阅读
  4. Adobe Application Manager丢失或损坏 - 解决方案

    2023-12-27 15:40:03       58 阅读
  5. 四种NAT的网络结构

    2023-12-27 15:40:03       36 阅读