最终实现的日历效果

vue3页面已实现,可直接拿来用,背景需要自定义,这里把日历背景色设为透明了
js
<template>
<el-calendar ref="calendar" v-model="data.value">
<template #header="{ date }">
<div class="flex-between w100">
<div class="flex-start">
<!-- 上一年 -->
<el-icon color="#445cbf" @click="selectDate('prev-year')"><DArrowLeft /></el-icon>
<!-- 上一月 -->
<el-icon color="#445cbf" @click="selectDate('prev-month')"><ArrowLeft /></el-icon>
</div>
<span @click="selectDate('today')">{{ date }}</span>
<div class="flex-start">
<!-- 下个月 -->
<el-icon color="#445cbf" @click="selectDate('next-month')"><ArrowRight /></el-icon>
<!-- 下一年 -->
<el-icon color="#445cbf" @click="selectDate('next-year')"><DArrowRight /></el-icon>
</div>
</div>
</template>
</el-calendar>
</template>
<script setup lang="ts">
import { reactive,ref } from "vue";
import type { CalendarDateType, CalendarInstance } from 'element-plus'
import { DArrowLeft, ArrowLeft, ArrowRight, DArrowRight } from '@element-plus/icons-vue'
const calendar = ref<CalendarInstance>()
const selectDate = (val: CalendarDateType) => {
if (!calendar.value) return
calendar.value.selectDate(val)
}
const data = reactive({
value: new Date(),
});
</script>
<style lang="scss" scoped>
</style>
<style lang="scss">
.el-calendar{
background: transparent;
font-size: 14px;
}
.el-calendar-table .el-calendar-day{
height: 35px;
text-align: center;
}
.el-calendar-table thead th{
color:#999;
}
.el-calendar-table tr td:first-child,.el-calendar-table tr:first-child td{
border:0;
}
.el-calendar-table td{
border:0;
}
.el-calendar-table td.is-today{
background: #456cef;
border-radius: 10px;
color:#fff;
}
.el-calendar-table td.is-selected,.el-calendar-table .el-calendar-day:hover{
border-radius: 10px;
}
</style>