Created
July 29, 2021 06:47
-
-
Save gavinplatt/1dd271d507018cc3bf5026876e137124 to your computer and use it in GitHub Desktop.
Passing data to Vue component - texted Neo blocks, nested map filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# 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