What is the best way to include the jQuery library in Vue project?
I'm using a vue-cli, webpack and router. I have separate components and I need to include few jQuery plugins. If I include jQuery script in index file, then I have problem to manipulate (trigger) DOM from components. So I guess it's better to include all scripts in my main.js or components?
I need to implement Venobox plugin. This is basic jQuery initialization
$(document).ready(function(){
$('.venobox').venobox();
});
In Vue i tried with
mounted () {
$('.venobox').venobox();
}
Now I have problem with jQuery. '$' is not defined etc. What is the best practice to include external JS files in Vue project? Is there are ease way to initialize jQuery plugins?
Thanks!
mounted()looks like a good direction to do that. Can you install jQuery on the page the same way you install Vue?import $ from "jquery";.