vue-flatpickr v2.3.0
Vue-Flatpickr (^2.2.0)
Flatpickr for VueJS bases on the lastest version of Flatpickr (^2.2.5).
Demo: https://jrainlau.github.io/vue-flatpickr/
Version 2.x supports
VueJS 2.xonly. Check out themasterbranch for supportingVueJS 1.0
Install
npm install vue-flatpickr --saveUsage
Enter your main.js file which inits the VueJS:
import Vue from 'vue'
import App from './App.vue'
import VueFlatpickr from 'vue-flatpickr'
import 'vue-flatpickr/theme/airbnb.css'
Vue.use(VueFlatpickr)
new Vue({
el: '#app',
...App
})then you can use Vue-Flatpickr directly in your *.vue file:
<Flatpickr />Options
Use props to pass an option object to Vue-Flatpickr:
<!-- template -->
<Flatpickr :options="fpOptions" />// script
data () {
return {
fpOptions: {}
}
}
Vue-Flatpickrsupports all options as the Official Document, except the "Custom elements and input groups"
Data binding
Vue-Flatpickr supports v-model for data binding:
<!-- template -->
<Flatpickr v-model="dateStr" />// script
data () {
return {
dateStr: ''
}
}Themes
Vue-Flatpickr supports all the offical themes. You should import the theme you like from vue-flatpickr/theme after you've imported the VueFlatpickr.
import VueFlatpickr from 'vue-flatpickr'
import 'vue-flatpickr/theme/airbnb.css'Themes you could use:
airbnb.cssbase16_flat.cssconfetti.cssdark.cssflatpickr.min.cssmaterial_blue.cssmaterial_green.cssmaterial_orange.cssmaterial_red.css
Development
- Run dev
git clone https://github.com/jrainlau/vue-flatpickr.git
cd vue-flatpickr && npm install
npm run dev- Run build-demo
npm run build-demothen checkout the /dist folder for demo.
- Run build
npm run buildthen checkout the /dist folder for bundle.
Vue-Flatpickris usingeslint-standar, all pull request must follow the standar nor not allow to be merged.
Lisense
MIT
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago