I've started a VueJS project with:
vue init webpack my-project
And got jQuery with npm:
npm install jquery
And i put this line on my main.js file:
window.$ = window.jQuery = require('jquery')
Either way, i can't use this piece of code: (from semantic ui)
$('.ui.rating')
.rating()
;
Because i get this error:
Uncaught ReferenceError: $ is not defined
Any idea why this is happening ?
If you have jQuery installed via npm, just import it like this:
import $ from 'jquery'
And inside your methods, you can start using $
as:
methods: {
getFoo() {
$( "div.foo" ).html();
}
}