Note: vue-cli3.0 no webpack.config.js profile, replaced by a set of configuration files in vue.config.js
default has been installed vue-cli3.0 project
step1: command-line tool, into the project file folder, execute: npm install jQuery --save
step2: tips after a successful installation, "dependencies" check in package.json file has a "jquery": "^ 3.3.1" , ( as there is no need to manually add) :
Step3: .eslintrc.js file, env added jQuery: to true
Step4: [key] step
vue.config.js file: Add most head "const webpack = require ( 'webpack ')"; module.exports in added:
configureWebpack: {
plugins: [
new new webpack.ProvidePlugin ({
$: "jQuery",
the jQuery: "jQuery",
"windows.jQuery": "jQuery"
})
]
}
STEP5: main.js introducing "import $ from 'jquery'"
Step6: Restart vue-cli, page components in the script tag add the following test code, the page can pop success