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

96 lines
3.4 KiB
Vue
Raw Normal View History

2024-04-18 14:22:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>A time picker is displayed when <i>showTime</i> is enabled where 12/24 hour format is configured with <i>hourFormat</i> property. In case, only time needs to be selected, add <i>timeOnly</i> to hide the date section.</p>
</DocSectionText>
2024-07-02 10:05:17 +00:00
<div class="card flex flex-wrap gap-4">
2024-04-18 14:22:30 +00:00
<div class="flex-auto">
<label for="datepicker-12h" class="font-bold block mb-2"> 12h Format </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-12h" v-model="datetime12h" showTime hourFormat="12" fluid />
2024-04-18 14:22:30 +00:00
</div>
<div class="flex-auto">
<label for="datepicker-24h" class="font-bold block mb-2"> 24h Format </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-24h" v-model="datetime24h" showTime hourFormat="24" fluid />
2024-04-18 14:22:30 +00:00
</div>
<div class="flex-auto">
<label for="datepicker-timeonly" class="font-bold block mb-2"> Time Only </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-timeonly" v-model="time" timeOnly fluid />
2024-04-18 14:22:30 +00:00
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
datetime12h: null,
datetime24h: null,
time: null,
code: {
basic: `
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-12h" v-model="datetime12h" showTime hourFormat="12" fluid />
<DatePicker id="datepicker-24h" v-model="datetime24h" showTime hourFormat="24" fluid />
<DatePicker id="datepicker-timeonly" v-model="time" timeOnly fluid />
2024-04-18 14:22:30 +00:00
`,
options: `
<template>
2024-07-02 10:05:17 +00:00
<div class="card flex flex-wrap gap-4">
2024-04-18 14:22:30 +00:00
<div class="flex-auto">
<label for="datepicker-12h" class="font-bold block mb-2"> 12h Format </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-12h" v-model="datetime12h" showTime hourFormat="12" fluid />
2024-04-18 14:22:30 +00:00
</div>
<div class="flex-auto">
<label for="datepicker-24h" class="font-bold block mb-2"> 24h Format </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-24h" v-model="datetime24h" showTime hourFormat="24" fluid />
2024-04-18 14:22:30 +00:00
</div>
<div class="flex-auto">
<label for="datepicker-timeonly" class="font-bold block mb-2"> Time Only </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-timeonly" v-model="time" timeOnly fluid />
2024-04-18 14:22:30 +00:00
</div>
</div>
</template>
<script>
export default {
data() {
return {
datetime12h: null,
datetime24h: null,
time: null
};
}
};
<\/script>
`,
composition: `
<template>
2024-07-02 10:05:17 +00:00
<div class="card flex flex-wrap gap-4">
2024-04-18 14:22:30 +00:00
<div class="flex-auto">
<label for="datepicker-12h" class="font-bold block mb-2"> 12h Format </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-12h" v-model="datetime12h" showTime hourFormat="12" fluid />
2024-04-18 14:22:30 +00:00
</div>
<div class="flex-auto">
<label for="datepicker-24h" class="font-bold block mb-2"> 24h Format </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-24h" v-model="datetime24h" showTime hourFormat="24" fluid />
2024-04-18 14:22:30 +00:00
</div>
<div class="flex-auto">
<label for="datepicker-timeonly" class="font-bold block mb-2"> Time Only </label>
2024-07-02 10:05:17 +00:00
<DatePicker id="datepicker-timeonly" v-model="time" timeOnly fluid />
2024-04-18 14:22:30 +00:00
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
const datetime12h = ref();
const datetime24h = ref();
const time = ref();
<\/script>
`
}
};
}
};
</script>