A Vue component that wraps the Flatpickr.
Demo: jrainlau.github.io/vue-flatpic…
Install
npm install vue-flatpickr
Usage
Enter one of your .vue file, load the instance VueFlatpickr-en.vue (or VueFlatpickr-zh for Chinese), and the stylesheet flatpickr.min.css.
Note that you have set the correct path, for example you might set the path as
../node_modules/vue-flatpickr/VueFlatpickr-en.vueand so on.
@import './assets/flatpickr.min.css';
Options
Use props to pass the options object to vue-flatpickr. The options are same to the official document. Here is an example below:
data() {
return {
fpOptions: {
enableTime: true
}
}
}
Data binding
The tag could be use as a normal tag, which you can use v-model to bind data withVue model:
Themes
vue-flatpickr supports all the offical themes, all you need to do is to pick up the one you like:
flatpickr.min.cssflatpickr.confetti.min.cssflatpickr.dark.min.cssflatpickr.material_blue.min.cssflatpickr.material_green.min.cssflatpickr.material_orange.min.cssflatpickr.material_red.min.css
Lisense
MIT