IMG-LOGO

How to use JQuery in Vue.js 2?

andy - 16 May, 2018 13494 Views 2 Comment

If you need to use or import the JQuery file in Vue.js 2, you can use the following step by step on how to import JQuery into your Vue.js application. In the NodeJS command prompt, run the following command.

npm install jquery --save

The above command will download the JQuery files and placed it under the node_modules folder. If you browse your node_modules folder you will see the Jquery folder files.

The next part is to add the JQuery plugin to the webpack.dev.conf.js and webpack.prod.conf.js files. Open the file and look for the plugins section. Add the following code to the plugins array section.

new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery'
    })

Here is the screenshot of the plugin arrays.

Comments

Naeem
27 Nov, 2018
how to use jquery in bable ??
Jonthan
03 Jan, 2019
Thank you so much!
Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.

Related Articles