Home> Web Front-end> Vue.js> body text

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

王林
Release: 2020-11-30 14:58:58
Original
2904 people have browsed it

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
Copy after login

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

(1) Introduce webpack at the top

var webpack=require('webpack')
Copy after login

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

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

3. In the entry file Enter

import $ from 'jquery'
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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