两列布局小部件损坏

two column layout widget broken

嗨,

我正在学习本教程: 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

––– –– –

结果:

––– –– –

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

区域的name属性必须是点notation-valid名称,twoColumnLayout而不是two-column-layout

在您的 home.html 中将区域呼叫更改为

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

来自 MDN 的有效 JavaScript 标识符命名

... a sequence of alphanumerical characters, also including the underscore ("_") and dollar sign ("$"), that cannot start with a number.

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