vue使用jquery
vue使用jquery
第一步 安装
npm install jquery --save
第二步 配置
在
vue.config.js中添加以下代码
module.exports = {
chainWebpack: config => {
config.plugin('provide').use(webpack.ProvidePlugin, [{
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}])
},
}
第三步 使用
在需要使用的地方引用
import $ from 'jquery'

浙公网安备 33010602011771号