在 prestashop 1.7 的管理模块中启用 jquery2
enabling jquery2 in an admin module for prestashop 1.7
我正在使用 prestashop 1.7.2.0 编写一个管理模块,从 csv 文件添加嵌套类别和产品。我知道 addJQuery()
已被弃用,我正在尝试让 jquery 代码正常工作。 I get Uncaught ReferenceError: $ is not defined
.
我创建了一个 displayBackOfficeHeader
挂钩,其中包含以下内容:
public function hookDisplayBackOfficeHeader(){
$this->context->controller->addJS($this->_path.'/js/jqShim.min.js');
$this->context->controller->addCSS($this->_path.'/css/getcontent.css');
$this->context->controller->addJS($this->_path.'/js/getcontent.js');
}
如您所见,我已尝试包含 jqShim.min.js
,但我仍然遇到相同的错误。我错过了什么?
谢谢
您可以在 hookDisplayBackOfficeHeader()
函数的第一行包含 $this->context->controller->addJquery();
。
我正在使用 prestashop 1.7.2.0 编写一个管理模块,从 csv 文件添加嵌套类别和产品。我知道 addJQuery()
已被弃用,我正在尝试让 jquery 代码正常工作。 I get Uncaught ReferenceError: $ is not defined
.
我创建了一个 displayBackOfficeHeader
挂钩,其中包含以下内容:
public function hookDisplayBackOfficeHeader(){
$this->context->controller->addJS($this->_path.'/js/jqShim.min.js');
$this->context->controller->addCSS($this->_path.'/css/getcontent.css');
$this->context->controller->addJS($this->_path.'/js/getcontent.js');
}
如您所见,我已尝试包含 jqShim.min.js
,但我仍然遇到相同的错误。我错过了什么?
谢谢
您可以在 hookDisplayBackOfficeHeader()
函数的第一行包含 $this->context->controller->addJquery();
。