php - 如何注册 Prestashop 组件 JavaScript 文件?
问题描述
我希望在 prestashop 1.7 中注册一个 Javascript 文件。
我想用registerJavascript()
这个。
该文件位于“themes/new-theme/js/components/choice-table.js”中。
但我的代码不起作用:
public function hookHeader($params)
{
$this->context->controller->registerJavascript(
'choice-table',
'themes/new-theme/js/components/choice-table.js',
[
'priority' => 150,
'position' => 'bottom',
'attribute' => 'defer'
]
);
}
}
任何想法?
解决方案
我最终不得不将文件 'choice-table.js' 与 webpack 捆绑在一起。
推荐阅读
- terraform - 禁用 terraform 颜色输出 - 2021 年 9 月
- amazon-web-services - AWS Personalize 的分页 GetRecommendations API
- python-3.x - 如何在不和谐机器人中流式传输和排队歌曲?
- python - python socket OSError: [WinError 10038] 尝试对不是套接字的东西进行操作
- reactjs - 如何使用 React 测试库测试来自 React Redux 的 Field 组件?
- python - 用 Pandas DataFrame 中最近正常数据点的平均值替换异常值
- cypress - 如何使用柏树从下拉列表中选择值?
- c# - 需要在 C# 中将 simpledateformat(EEE MMM d HH:mm:ss z yyyy) 转换为 DateTime
- excel - 为什么我的代码不适用于我在编写代码后添加的单元格?
- python - 如何更改标签的背景颜色或以其他方式使它们更具可读性?