daily pastebin goal
77%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top