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页面

浙公网安备 33010602011771号