0

I'm new in JS and Vue, really struggle with this one:

Fiddle

No popup, but when I'm moving $('.date-range-picker').daterangepicker(...) outside Vue instance, everything is ok, picker popup are shown.

amb1dex
  • 34
  • 3
  • i am wondering if the class exists on the DOM when the `methods.onClick` code is evaluated, maybe you need a delegated click event, however not sure how you would implement it here. – HolyMoly Jun 27 '18 at 20:15
  • put your codes into mounted hook like `mounted: function () { var vm = this; $('.date-range-picker').daterangepicker({ opens: 'right' }, function(start, end, label) { vm.dateRange = start.format('DD.MM.YYYY') + ' - ' + end.format('DD.MM.YYYY'); }); },` then you'd better check [Use JQuery in Vue](https://stackoverflow.com/questions/37928998/how-to-use-a-jquery-plugin-inside-vue) and [Make VueJS and jQuery play nice](https://stackoverflow.com/questions/43240789/make-vuejs-and-jquery-play-nice), anyway, it is not recommanded to use JQuery in Vue. – Sphinx Jun 27 '18 at 20:15
  • like [this fiddle](https://jsfiddle.net/dxtf04vL/) – Sphinx Jun 27 '18 at 20:22
  • `mounted` solution works fine for me. Thank you [Sphinx](https://stackoverflow.com/users/5665870/sphinx), save my day. – amb1dex Jun 27 '18 at 20:45

1 Answers1

1

Suddenly found workaround via input tag and focus event:

Fiddle

amb1dex
  • 34
  • 3