Home  >  Article  >  Web Front-end  >  How to import jquery third-party plug-in in vue scaffolding

How to import jquery third-party plug-in in vue scaffolding

王林
王林Original
2020-11-25 14:00:132967browse

How to import jquery third-party plug-in into vue scaffolding: 1. Download jquery; 2. Edit the webpack.base.conf.js file, introduce webpack, and configure the jquery plug-in; 3. Enter [import in the entry file $ from 'jquery'].

How to import jquery third-party plug-in in vue scaffolding

The operating environment of this tutorial: Windows 10 system, vue version 2.9. This method is suitable for all brands of computers.

(Learning video sharing: javascript video tutorial)

1. Download jquery

npm install jquery --save

2. Open webpack.base in the build folder. conf.js file:

(1) Introduce webpack at the top

 var webpack=require('webpack')

(2) Configure the JQuery plug-in in module.exports:

plugins: [ 
           new webpack.ProvidePlugin({ 
                 $:"jquery", 
                 jQuery:"jquery", 
                "windows.jQuery":"jquery"
        }) 
      ],

3. In the entry file Enter

import $ from 'jquery'

in main.js 4. Test using

How to import jquery third-party plug-in in vue scaffolding

Related recommendations: vue.js tutorial

The above is the detailed content of How to import jquery third-party plug-in in vue scaffolding. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn