A custom directive for using Pikaday in Vue.js apps.
-
Download this repo and copy file
directives/pikaday.js
into your project. -
Register Vue-Pikaday as a directive in your
main.js
:// main.js Vue.directive('pikaday', require('./directives/pikaday'));
-
Vue-Pikaday need an
<input>
element to display time. Addv-pikaday
directive to this<input>
and assign a string value to it.// template.html <input type="text" v-pikaday="defaultDate"> // index.js module.exports = { template: require('./template.html'), data: function () { return { defaultDate: '' }; } }
-
If you want a different format of time, there's a
format
option to do this.// template.html <input type="text" v-pikaday="defaultDate" format="MMMM Do, YYYY">
MIT