李恒道 发表于 2022-11-26 20:28:15

油猴引入jquery提示$ is not deifined

解决方案
声明
```
/* globals$ */
```

```
// ==UserScript==
// @name         New Userscript
// @namespace    https://bbs.tampermonkey.net.cn/
// @version      0.1.0
// @descriptiontry to take over the world!
// @author       You
// @match      {{match}}
// ==/UserScript==
/* globals$ */
```

王一之 发表于 2022-11-26 20:50:23

下版本加一下自定义eslint

steven026 发表于 2022-11-26 21:36:29

https://bbs.tampermonkey.net.cn/forum.php?mod=redirect&goto=findpost&ptid=2809&pid=31571
或者直接定义$
如果是油猴单独引入无论是否沙盒都可以直接用`const $=window.jQuery`

李恒道 发表于 2022-11-26 21:37:44

steven026 发表于 2022-11-26 21:36
https://bbs.tampermonkey.net.cn/forum.php?mod=redirect&goto=findpost&ptid=2809&pid=31571
或者直 ...

woc get dao le

极品小猫 发表于 2022-11-28 12:19:21

李恒道 发表于 2022-11-26 21:37
woc get dao le

人懒惰起来,会不顾一切
页: [1]
查看完整版本: 油猴引入jquery提示$ is not deifined