Items in nodes

Posted By Will Moody On , Reading Time - 1 minutes


Items in nodes in gridsome

This is just a small code change that was pointed out to me by @courcelan on the Gridsome Discord.

<article v-for="item in $page.sitepages.edges" :key="">

Can be replaced with

<article v-for="{ node } in $page.sitepages.edges" :key="">

And then used like this:-

<h2>{{ node.title }}</h2>
<div v-html="node.content" />

The item can then be missed out, just a little bit less typing, which is great.