我有一个自定义模块filter_component,它提供了一个表单。在我的表格中:
$form['#attached']['library'][] = 'filter_component/filter-component';
在filter_component.libraries.yml中,我有:
filter-component:
version: 1.x
js:
js/filter_component.js: {}
dependencies:
- core/jquery
- core/jquery.once
filter_component.js的开头是:
(function ($, Drupal) {
Drupal.behaviors.filterComponent = {
attach: function (context, settings) {
$('.block-filter-component', context).once('filterComponent').each(function() {
一切都很好,但只有在禁用big_pipe的情况下才行。启用它时,代码不会附加,js文件也不会作为源在页面源或浏览器工具中列出。
发布于 2019-12-25 19:26:51
原来是大管道,但和我的模块无关。在页面的其他地方,将加载配置文件图像,使其出现在用户名旁边,如果用户没有,则将显示默认图像。如果返回404 (在本例中是因为还不存在匹配为映像提供的路径的部分誓言),那么当大管道加载它并获得404时,下游js不会被加载。
https://drupal.stackexchange.com/questions/289474
复制相似问题