Skip to content

Commit 6e7c86f

Browse files
authored
feat(picker-day): add dayCelltContent slot (sumcumo#95)
1 parent bd7f738 commit 6e7c86f

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

docs/guide/Slots/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,16 @@ To provide custom content for the clear button, the `clearBtn` slot may be used:
9898
</template>
9999
</DatePicker>
100100
```
101+
102+
103+
## dayCellContent
104+
105+
To provide custom content for the dayCellContent, the `dayCellContent` slot may be used:
106+
107+
```html
108+
<DatePicker :clear-button="true">
109+
<template #dayCellContent="{ cell }">
110+
<span>{{ cell.date }}</span>
111+
</template>
112+
</DatePicker>
113+
```

src/components/Datepicker.vue

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
<template v-for="slotKey of calendarSlots">
8383
<slot :slot="slotKey" :name="slotKey" />
8484
</template>
85+
<template #dayCellContent="{ cell }">
86+
<slot name="dayCellContent" :cell="cell" v-if="cell" />
87+
</template>
8588
</Component>
8689
<slot name="calendarFooter" />
8790
</div>

src/components/PickerDay.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
:class="dayClasses(cell)"
3232
@click="select(cell)"
3333
>
34-
{{ dayCellContent(cell) }}
34+
<slot name="dayCellContent" :cell="cell">
35+
{{ dayCellContent(cell) }}
36+
</slot>
3537
</span>
3638
</div>
3739
</div>

0 commit comments

Comments
 (0)