将 jQuery 包含在我的 typo3 扩展问题中

Including jQuery into my typo3 extension issues

目前我正在将我所有的 typo3 6.2.31 扩展迁移到 8.7。

我有一些关于在我的后端插件中使用 jQuery 的问题。

我必须包含 jQuery 还是它会自动从 Typo3 8.7 导入?

如果是,我是否必须使用 $jQuery 作为选择器?

目前我收到这个错误:

Uncaught TypeError: $(...).tablesorter is not a function
   at HTMLDocument.<anonymous> (VM2139 global.js:68)
   at j (VM2124 jquery-1.11.2.min.js:2)
   at Object.fireWith [as resolveWith] (VM2124 jquery-1.11.2.min.js:2)
   at Function.ready (VM2124 jquery-1.11.2.min.js:2)
   at HTMLDocument.J (VM2124 jquery-1.11.2.min.js:2)

提前致谢!

这个问题可能和你的一样,也许答案能帮到你

由于上述事实,我将您的问题标记为重复。

jquery 通常总是加载在后端模块中,你可以使用 $.然而,tablesorter 插件并不是默认插件,您可能需要加载/注册该插件。您可能会在核心中找到示例,例如扩展管理器加载数据表插件。

在视图助手级别,jQuery 默认包含在 https://docs.typo3.org/typo3cms/extensions/core/Changelog/8.7/Deprecation-80047-DeprecateJQueryAndExtJSForBEViewhelpers.html

提示:转到安装工具 "upgrade analysis" 并搜索 jquery。

如果您正在处理基于 extbase 的插件,核心扩展的 PermissionController be_user 可能是一个相对简单的地方,可以查看核心扩展如何解决 v8 中的后端模块。