Skip to content

Instantly share code, notes, and snippets.

@gavinplatt
Created July 29, 2021 06:47
Show Gist options
  • Save gavinplatt/1dd271d507018cc3bf5026876e137124 to your computer and use it in GitHub Desktop.
Save gavinplatt/1dd271d507018cc3bf5026876e137124 to your computer and use it in GitHub Desktop.
Passing data to Vue component - texted Neo blocks, nested map filter
{# Get this Neo block's child blocks #}
{% set items = block.children %}
{# Prep items for Vue. Note second level of child blocks #}
{% set itemsPrepped = items.all|map(i => {
label: i.label,
years: i.children.all|map(y => {
value: y.number,
suffix: y.label ?? false
})
}) %}
<timeline
:items="{{ itemsPrepped|json_encode }}"
>
</timeline>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment