【问题标题】:knockout.js Uncaught TypeError: Unable to process bindingknockout.js 未捕获类型错误:无法处理绑定
【发布时间】:2017-01-10 11:04:39
【问题描述】:

我正在使用 Porto v2.2.0 – Ultimate Responsive Magento 主题并显示类似

的错误
knockout.js:3012 Uncaught TypeError: Unable to process binding "css: function (){return { empty:cart().summary_count == 0} }"
Message: cart is not a function

【问题讨论】:

  • 分享你的模型,好像cart不是ko.observable,函数或者computed字段

标签: knockout.js magento2


【解决方案1】:

我已经分三步解决了:

  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. 用核心模板(供应商\ magento\module-checkout\view\frontend\web\template\minicart\content.html)

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

修复后的结果迷你车:

【讨论】:

  • 有人帮我看看 php magento setup:static-content:deploy 与 php magento setup:static-content:deploy -f 之间的差异
  • 在默认和开发者模式下,Magento 会按需生成静态内容。但是如果你想强制部署静态内容,你需要使用 -f 参数。
猜你喜欢
  • 2017-04-19
  • 2016-09-27
  • 2021-04-29
  • 1970-01-01
  • 2020-05-03
  • 2014-07-09
  • 2016-04-28
  • 2021-06-07
  • 2019-03-30
相关资源
最近更新 更多