两列布局小部件坏了

时间:2018-03-15 08:41:50

标签: apostrophe-cms

您好,

我正在关注本教程: 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

--- - -

结果:

enter image description here

--- - -

我在控制台中没有出现任何错误, 如何调试这样的东西? 什么是错的,拜托?

1 个答案:

答案 0 :(得分:4)

区域的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