Basic VueJs Component with flatpickr directive (working)
POC of a flatpickr directive - working on mobile broken: https://jsfiddle.net/escapedcat/zcxbdg0n/
by escapedcat
HTML
<link rel="stylesheet" href="https://cdn.rawgit.com/chmln/flatpickr/v3.0.5-1/dist/flatpickr.css">
<script src="https://cdn.rawgit.com/chmln/flatpickr/v3.0.5-1/dist/flatpickr.js"></script>
<script src="https://rawgit.com/vuejs/vue/v2.3.4/dist/vue.js"></script>
<div id="app">
<greeting></greeting>
</div>
JavaScript
Vue.component('greeting', {
template: '<div><h1>Welcome to flatpickr!</h1><input type="text" v-flatpickr="{}" /></div>'
});
Vue.directive('flatpickr', {
inserted: (el, binding) => {
console.log('flatpickr bind', el)
el._flatpickr = new flatpickr(el, binding.value)
},
unbind: el => el._flatpickr.destroy()
})
// create a new Vue instance and mount it to our div element above with the id of app
var vm = new Vue({
el: '#app'
});