Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Vue.directive('calendar', {
  2. inserted(el, binding) {
  3. // :v-calendar="{ format: 'YYYY-MM-DD HH:mm:ss' }"
  4. const options = Object.assign({
  5. // Some default options
  6.  
  7. // Use FontAwesome icons
  8. icons:{
  9. time: 'fa fa-clock-o',
  10. date: 'fa fa-calendar',
  11. up: 'fa fa-chevron-up',
  12. down: 'fa fa-chevron-down',
  13. previous: 'fa fa-chevron-left',
  14. next: 'fa fa-chevron-right',
  15. today: 'fa fa-calendar-check-o',
  16. clear: 'fa fa-trash-o',
  17. close: 'fa fa-close'
  18. }
  19. }, binding.value || {});
  20.  
  21. $(el).datetimepicker(options).on('dp.change', function (event) {
  22. const input = el.querySelector('input');
  23.  
  24. let e = new Event('change');
  25. input.dispatchEvent(e);
  26.  
  27. e = new Event('input');
  28. input.dispatchEvent(e);
  29. });
  30. }
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement