vue项目引入jquery步骤

  1. 在package.json文件 添加jQuery依赖
"dependencies": {
      "jquery": "1.11.1"
}

2、在webpack.base.conf.js中module.exports 添加jQuery插件

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

3、在main.js引入jQuery

//引入JQ
import $ from 'jquery'

4、重新安装项目依赖

npm i

5、启动项目

npm run dev

你可能感兴趣的:(vue项目引入jquery步骤)