【问题标题】:two column layout widget broken两列布局小部件损坏
【发布时间】:2018-03-15 21:37:22
【问题描述】:

嗨,

我正在关注本教程: https://apostrophecms.org/docs/tutorials/getting-started/layout-widgets.html

这是我的代码: https://github.com/daslicht/apostrope-starter/blob/master/lib/modules/two-column-widgets/index.js

––– –– –

结果:

––– –– –

我在控制台中没有收到任何错误, 如何调试这样的事情? 请问有什么问题吗?

【问题讨论】:

    标签: apostrophe-cms


    【解决方案1】:

    区域的name 属性必须是点表示法有效的名称,twoColumnLayout 而不是two-column-layout

    在您的home.html 中将区域呼叫更改为看起来像

    {{
      apos.area(data.page, 'twoColumnLayout', {
        widgets: {
          'two-column': {}
        }
      })
    }}
    

    来自 MDN 关于有效 JavaScript 标识符命名

    ... 一系列字母数字字符,也包括下划线 ("_") 和美元符号 ("$"),不能以数字开头。

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors

    【讨论】:

      猜你喜欢
      • 2015-10-16
      • 1970-01-01
      • 2020-09-08
      • 2015-11-29
      • 1970-01-01
      • 2017-06-09
      • 2021-12-30
      • 2015-11-23
      • 1970-01-01
      相关资源
      最近更新 更多