从嵌套对象设置nunjucks变量

时间:2020-10-15 21:57:32

标签: javascript nunjucks

对于较长的控制台日志,我深表歉意,但我的问题需要它。我正在尝试将'intro'(从底部开始的第十二个)的值设置为nunjucks变量,只是似乎无法使用正确的语法。日志如下(来自airtables API):我使用一个函数来调用作为命名对象“应用程序”返回的数据,因此我正在尝试类似

{% set intro =  applications[0].fields.intro %} 

但是那没有用。预先感谢

[
      Record {
        _table: Table {
          _base: [Base],
          id: null,
          name: 'applications',
          find: [Function],
          select: [Function: bound ],
          create: [Function],
          update: [Function],
          replace: [Function],
          destroy: [Function],
          list: [Function],
          forEach: [Function]
        },
        id: 'rec7FuJxke2mL104B',
        _rawJson: {
          id: 'rec7FuJxke2mL104B',
          fields: {},
          createdTime: '2020-10-14T15:02:53.000Z'
        },
        fields: {},
        save: [Function],
        patchUpdate: [Function],
        putUpdate: [Function],
        destroy: [Function],
        fetch: [Function],
        updateFields: [Function],
        replaceFields: [Function]
      },
      Record {
        _table: Table {
          _base: [Base],
          id: null,
          name: 'applications',
          find: [Function],
          select: [Function: bound ],
          create: [Function],
          update: [Function],
          replace: [Function],
          destroy: [Function],
          list: [Function],
          forEach: [Function]
        },
        id: 'recJWqHcYUx0Q9Cih',
        _rawJson: {
          id: 'recJWqHcYUx0Q9Cih',
          fields: [Object],
          createdTime: '2020-10-13T22:37:03.000Z'
        },
        fields: {
          Post: 'https://www.yokoco.com/career/digital-designer-art-director/',
          intro: "As well as super-hero mind powers, my last role involved collaborating with Cafédirect, the UK's first 'B' corp certified coffee company, investing 50% of their profits into Producers Direct. As Big Al's head of art, alongside a copywriter, I completed typographic treatments and illustration styles for Cafédirects up and coming poster and social campaign, Hooray for poverty-free coffee!\n",
          Job: 'Digital Designer / Art Director',
          Sent: '2020-10-13',
          Status: 'In progress'
        },
        save: [Function],
        patchUpdate: [Function],
        putUpdate: [Function],
        destroy: [Function],
        fetch: [Function],
        updateFields: [Function],
        replaceFields: [Function]
      }
    ]

0 个答案:

没有答案