feat(components): calendar component header support slot (#3316)

* feat(components): calendar component header support slot

* feat(components): calendar component header support slot

* feat(components): calendar component header support slot
This commit is contained in:
啝裳 2021-09-12 18:32:53 +08:00 committed by GitHub
parent d43064c054
commit 629fef2993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,20 +1,25 @@
<template>
<div class="el-calendar">
<div class="el-calendar__header">
<div class="el-calendar__title">{{ i18nDate }}</div>
<div v-if="validatedRange.length === 0" class="el-calendar__button-group">
<el-button-group>
<el-button size="mini" @click="selectDate('prev-month')">
{{ t('el.datepicker.prevMonth') }}
</el-button>
<el-button size="mini" @click="selectDate('today')">
{{ t('el.datepicker.today') }}
</el-button>
<el-button size="mini" @click="selectDate('next-month')">
{{ t('el.datepicker.nextMonth') }}
</el-button>
</el-button-group>
</div>
<slot name="header" :date="i18nDate">
<div class="el-calendar__title">{{ i18nDate }}</div>
<div
v-if="validatedRange.length === 0"
class="el-calendar__button-group"
>
<el-button-group>
<el-button size="mini" @click="selectDate('prev-month')">
{{ t('el.datepicker.prevMonth') }}
</el-button>
<el-button size="mini" @click="selectDate('today')">
{{ t('el.datepicker.today') }}
</el-button>
<el-button size="mini" @click="selectDate('next-month')">
{{ t('el.datepicker.nextMonth') }}
</el-button>
</el-button-group>
</div>
</slot>
</div>
<div v-if="validatedRange.length === 0" class="el-calendar__body">
<date-table :date="date" :selected-day="realSelectedDay" @pick="pickDay">