nuxt安装jquery

原文:http://lininn.cn/?post=411

npm install jquery --save

nuxt.config.js:

const webpack=require(‘webpack’);

 

 build: {
    /*
    ** You can extend webpack config here
    */
   plugins: [
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery:'jquery',
      'window.jQuery':'jquery'
    })
  ],
    extend (config, ctx) {
    }
  }

 

或者:

nuxt.config.js

module.exports = {
head: {
    script: [
      { src: 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' }
    ]
},

当然  第二种 你可以直接写在 要引用的.vue页面

posted @ 2020-01-31 11:07  鳳舞九天  阅读(670)  评论(0)    收藏  举报