Objective
Although Vue does not recommend manipulating the DOM directly, it also provides a way to manipulate the DOM. But when it comes to jquery at some point, how do you introduce jquery when using VUE-CLI?
Installation
Domestic Mirror CNPM Installation
CNPM Install jquery--save-dev
Configuration
The Webpack has provideplugin plug-ins, which can be automatically introduced into modules. So you need to add the following configuration to the webpack.base.config.js of the Project project:
ConstWebpack = require ('Webpack') Plugins: [NewWebpack. Provideplugin ({//Introducing jquery$:'jquery', JQuery:'jquery', 'Window.jquery':'jquery' }) ]
Resolve Error
After adding the above configuration, the project file used ' $ ', found still will error---eslint error
Eslint that there is no declaration that a globals configuration needs to be added to the Eslintrc.js
Globals: { '$'false, 'jquery 'false }
This makes it possible to call ' $ ' normally.
Attention
After modifying the configuration, to stop the project, the restart will not take effect.
How to introduce jquery in VUE-CLI