VUE 使用JQ

版权声明:请尊重原创 https://blog.csdn.net/Ag_wenbi/article/details/80835077

1,在安装好VUE需要的环境前提下,输入npm install jquery --save或者cnpm install jquery --save

2,在webpack.base.conf.js加入var webpack = require(“webpack”);

3,还是在webpack.base.conf.js下,在module.exports中加入

plugins: [
    new webpack.optimize.CommonsChunkPlugin('common.js'),
    new webpack.ProvidePlugin({
      jQuery: "jquery",
      $: "jquery"
    })
  ]

4,最后在main.js中加入来自“jQuery的”的进口$;

5,截图如下

猜你喜欢

转载自blog.csdn.net/Ag_wenbi/article/details/80835077