feat(VDatePicker): pass through slots for day, week, month to sub components#21121
Open
luukvnes wants to merge 7 commits intovuetifyjs:devfrom
Open
feat(VDatePicker): pass through slots for day, week, month to sub components#21121luukvnes wants to merge 7 commits intovuetifyjs:devfrom
luukvnes wants to merge 7 commits intovuetifyjs:devfrom
Conversation
Member
|
There's already a slot for this: <template #day="{ item, props }">
<v-btn
v-bind="props"
:class="{ 'custom-class': item.date.getDay() % 2 == 0 }"
/>
</template> |
Author
|
@KaelWD Ah, i missed that. Currently though the VDatePicker does not pass slots through to the VDatePickerMonth. Would a pull request including a change like the following (where slots are passed through) be accepted? luukvnes@d09c303#diff-e52a094feb57d0b046a8b9c49e5b4870078f419377cccff97ad7bac766cd09ab Obviously this is missing type declarations and documentions, but as an idea |
Member
|
Ok yeah that should definitely be forwarded. |
Author
<template>
<v-app>
<v-container>
<v-date-picker>
<template #day="{ item, props }">
<v-btn
v-bind="props"
:class="{ 'custom-class': item.date.getDay() % 2 == 0 }"
/>
</template>
<template #month="{ month, props }">
<v-btn
v-bind="props"
:class="{ 'custom-class': month.text == 'Jan' }"
>
{{ month.text }}
</v-btn>
</template>
<template #year="{ year, props }">
<v-btn
v-bind="props"
:class="{ 'custom-class': year.text == '2022' }"
/>
</template>
</v-date-picker>
</v-container>
</v-app>
</template>
<script>
export default {
name: 'Playground',
setup () {
return {
//
}
},
}
</script>
<style>
.custom-class {
border: 1px red solid;
}
</style>
|
Author
|
Description |
cb06ca9 to
83c0d3a
Compare
6331ca7 to
564ccc8
Compare
a7fa817 to
2e2cddb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This change adds a new dateClass prop to the VDatePicker and VDateInput components, allowing for custom styling of individual dates in the calendar.
The dateClass prop takes a function that takes a date and returns an array of classes. These classes are added to the dates in the calender.
My particular usecase is that i want to add a red border around particular days to signify an error happening on that day. Currently the easiest way is to use document.queryselector, this is particularly a nuisance, because you have to reapply the styling anytime the component switches to the view with single dates (not months/years).
Markup: