代码之家  ›  专栏  ›  技术社区  ›  geochanto

将工件连接到模块时,在编辑器模式保存期间出现撇号错误

  •  0
  • geochanto  · 技术社区  · 6 年前

    我创建了一个新的“模态”部分,在这里我加入了另一个模块(这样我可以在模态中显示模块)。我可以在编辑器模式中选择模块,但保存后会弹出此错误: An error occurred. Please try again later. 前端控制台显示这是来自 /modules/apostrophe-browser-utils/js/always.js

    我所拥有的只是 /lib/modules/modal/index.js版本 像这样的文件:

    module.exports = {
        extend: "apostrophe-pieces",
        name: "modal",
        label: "Modal",
        seo: false,
        addFields: [
          {
            name: "_image",
            type: "joinByOne",
            withType: "apostrophe-image",
            label: "Pick an image",
            required: true,
            idField: "_id",
            filters: {
              // Thought maybe not having a projection was an issue. didn't help
              projection: {
                attachment: 1
              }
            }
          }
        ]
      };
    

    屏幕Cap: https://screencast.com/t/OGQOD0PiG

    1 回复  |  直到 6 年前
        1
  •  1
  •   Stuart Romanek    6 年前

    这个 idField 名称与所有撇号文档的默认ID属性冲突。把它改成 imageId . 在所有情况下,除了 _id , the _ 撇号中的前缀表示某个属性,该属性在某一点上由撇号“填充”,而不是实际与文档一起保存。