primevue-mirror/apps/showcase/doc/datepicker/DateTemplateDoc.vue

75 lines
2.2 KiB
Vue

<template>
<DocSectionText v-bind="$attrs">
<p>Custom content can be placed inside date cells with the <i>date</i> slot that takes a Date as a parameter.</p>
</DocSectionText>
<div class="card flex justify-center">
<DatePicker v-model="date">
<template #date="slotProps">
<strong v-if="slotProps.date.day > 10 && slotProps.date.day < 15" style="text-decoration: line-through">{{ slotProps.date.day }}</strong>
<template v-else>{{ slotProps.date.day }}</template>
</template>
</DatePicker>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
date: null,
code: {
basic: `
<DatePicker v-model="date">
<template #date="slotProps">
<strong v-if="slotProps.date.day > 10 && slotProps.date.day < 15" style="text-decoration: line-through">{{ slotProps.date.day }}</strong>
<template v-else>{{ slotProps.date.day }}</template>
</template>
</DatePicker>
`,
options: `
<template>
<div class="card flex justify-center">
<DatePicker v-model="date">
<template #date="slotProps">
<strong v-if="slotProps.date.day > 10 && slotProps.date.day < 15" style="text-decoration: line-through">{{ slotProps.date.day }}</strong>
<template v-else>{{ slotProps.date.day }}</template>
</template>
</DatePicker>
</div>
</template>
<script>
export default {
data() {
return {
date: null
}
}
}
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
<DatePicker v-model="date">
<template #date="slotProps">
<strong v-if="slotProps.date.day > 10 && slotProps.date.day < 15" style="text-decoration: line-through">{{ slotProps.date.day }}</strong>
<template v-else>{{ slotProps.date.day }}</template>
</template>
</DatePicker>
</div>
</template>
<script setup>
import { ref } from "vue";
const date = ref();
<\/script>
`
}
};
}
};
</script>