vue-cli项目中使用jquery

第一种:绝对路径直接引入,全局可用

提示:在index.html中引入的文件必须放在static下面


1.在index.html中引入jquery.js

<script src="./static/jquery.js"></script>

注意:如果是在index.html引入的是自己写的全局的js,写在window.onload=function(){}  

2.在.vue文件即可使用了

<script>

mounted(){

console.log($)

}
</script>

猜你喜欢

转载自blog.csdn.net/weixin_39907729/article/details/81416013