TypeError: jQuery.subscribe is not a function on shopware5

TypeError: jQuery.subscribe is not a function on shopware5

我使用 "Bare" 主题作为父主题在 shopware5 上创建了一个自定义主题。我在我的主题上添加了 "Jquery" 库。

但是,当我在网站上加载某些页面时出现 "TypeError: jQuery.subscribe is not a function" 错误。

当我切换回响应式主题时,我发现没有这样的问题。

我需要在我的详细信息页面上使用图像缩放插件,但由于这个问题我无法设置该插件。

您的 JS 文件应该包含在您主题的 Theme.php 文件中。 示例:

protected $extend = 'Responsive';
... 
protected $javascript = array(
        'src/js/jquery.my-js-file.js',
    );
...
protected $name = <<<'SHOPWARE_EOD' ...

然后您应该清除缓存并编译您的主题。之后你就可以使用你的图书馆了。