Knockout.js Uncaught TypeError:无法处理绑定

Dim*_*ppy 5 knockout.js magento2

我正在使用 Porto v2.2.0 – Ultimate Responsive Magento Theme 并显示类似错误

knockout.js:3012 Uncaught TypeError: Unable to process binding "css: function (){return { empty:cart().summary_count == 0} }"
Message: cart is not a function
Run Code Online (Sandbox Code Playgroud)

小智 6

我分三步解决:

  1. 将主题(app\design\frontend\Theme_namespace\Theme_module\Magento_Ch??eckout\templates\car??t)中的minicart.phtml文件替换为核心模板(vendor\magento\module-checkout\view\frontend\templates\cart) ??)。

  2. 更换content.html从你的主题(APP \设计\前台\ Theme_namespace \ Theme_module \ Magento_Checkout \网络\模板\ minicart \ content.html)与核心模板(供应商\ Magento的\模块结账\图\前端\网络\模板文件\minicart\content.html)

  3. 删除所有 pub/static/frontend ,删除 var 文件夹。再次运行部署静态内容:php magento setup:static-content:deploy

修复后的结果微型车:

在此处输入图片说明