Search code examples
vue.jsvue-componentgridsome

page-query is not working inside component in Gridsome


If use <page-query> inside the index is working, but when I use it inside a component I get an error of "edges undefined". Any help?


Solution

  • It's normal, In Gridsome when you query inside a component instead of <page-query> you should use <static-query>. When using posts as alias (for example), your data will be available at $page.posts usually but if you are using <static-query> instead it will be available at $static.posts

    As you can read here