Skip to content

Instantly share code, notes, and snippets.

@chmln
Created June 1, 2017 01:22
Show Gist options
  • Save chmln/e77b52cf0a719e18233ca7948be8fab4 to your computer and use it in GitHub Desktop.
Save chmln/e77b52cf0a719e18233ca7948be8fab4 to your computer and use it in GitHub Desktop.
import Flatpickr from "flatpickr";
import Vue from "vue";
// <input type="text" v-flatpickr="{'enableTime': true}"
Vue.directive("flatpickr", {
bind: (el, binding) => {
el._flatpickr = new Flatpickr(el, binding.value);
},
unbind: el => el._flatpickr.destroy()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment