一、找到index.html
配置src
<script
src="https://code.jquery.com/jquery-3.1.0.js"
></script>
二、配置config
有的vue项目是有webpack.config.js这个配置文件
module.exports = {
//...
externals: {
jquery: 'jQuery',
},
};
vue-cli创建的已经将webpack.config.js配置好了
所以需要手动创建vue.config.js 进行配置
module.exports = {
externals: {
jquery: 'jQuery',
}
}
配置完毕就可以使用需要的js