App.vue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
<template> <section> <div class="form-group"> <label>Select a date</label> <div class="input-group"> <flat-pickr v-model="date" :config="config" class="form-control" placeholder="Select date" name="date" /> <div class="input-group-append"> <button class="btn btn-default" type="button" title="Toggle" data-toggle > <i class="fa fa-calendar" /> <span aria-hidden="true" class="sr-only">Toggle</span> </button> <button class="btn btn-default" type="button" title="Clear" data-clear > <i class="fa fa-times" /> <span aria-hidden="true" class="sr-only">Clear</span> </button> </div> </div> </div> <pre>Selected date is - {{ date }}</pre> </section> </template> <script setup> import { ref } from "vue"; import "bootstrap/dist/css/bootstrap.css"; // import this component import flatPickr from "vue-flatpickr-component"; import "flatpickr/dist/flatpickr.css"; // theme is optional // try more themes at - https://flatpickr.js.org/themes/ import "flatpickr/dist/themes/material_blue.css"; // localization is optional import { Hindi } from "flatpickr/dist/l10n/hi.js"; const date = ref("2022-10-28"); // Read more at https://flatpickr.js.org/options/ const config = ref({ wrap: true, // set wrap to true only when using 'input-group' altFormat: "M j, Y", altInput: true, dateFormat: "Y-m-d", locale:Hindi }); </script> |