vue版本:“vue”:"^2.5.16"
1、执行命令 npm install --save jquery
将jquery添加到packages.json文件下的 dependencies字段下面;
dependencies: {
“jquery”:"^3.3.1",
}
2、在main.js中加下如下代码
import $ from "jquery"
window.$ = $;
本文介绍如何在Vue项目中引入并使用jQuery。首先通过npm安装jQuery并将其添加到package.json依赖中,然后在main.js文件中导入jQuery并将其挂载到window对象上。
1701

被折叠的 条评论
为什么被折叠?