NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Homepage grid
  2. <template lang="pug">
  3. .page--index.f-row.between
  4. article.f-grow.shadow.b-radius
  5. header
  6. h1 {{ site }}: index
  7. section(v-if="allPagesLoaded")
  8. h4 pages
  9. p {{ Object.values(allPages).length }}
  10. section(v-if="allPostsLoaded")
  11. h4 posts
  12. p {{ Object.values(allPosts).length }}
  13. section
  14. //- COMPONENT: Looping component
  15. .post(v-for="post in allPosts")
  16. h4.post--title {{ post.slug }}
  17. ul.post--content
  18. li.post--content--block(v-for="block in post.blocks" v-html="block")
  19. footer.f-row
  20. p icon
  21. //- COMPONENT: Make this with a prop
  22. aside.shadow.b-radius
  23. header
  24. h4 this is some other stuff
  25. section(v-if="allPostsLoaded")
  26. //- COMPONENT: See above
  27. .post(v-for="post in allPosts")
  28. h4.post--title {{ post.slug }}
  29. ul.post--content
  30. li.post--content--block(v-for="block in post.blocks" v-html="block")
  31. </template>
  32. <script>
  33. import { mapGetters } from 'vuex'
  34. export default {
  35. computed: {
  36. ...mapGetters({
  37. somePages: 'somePages',
  38. allPages: 'allPages',
  39. allPostsLoaded: 'allPostsLoaded',
  40. allPosts: 'allPosts',
  41. allPagesLoaded: 'allPagesLoaded',
  42. }),
  43. },
  44. data() {
  45. return {
  46. site: wp.site_name,
  47. }
  48. },
  49. mounted() {
  50. console.log('routes: ', wp.routes)
  51. console.log('rest url: ', wp.rest)
  52. console.log('template: ', wp.template)
  53. this.$store.dispatch('getAllPages')
  54. this.$store.dispatch('getAllPosts')
  55. }
  56. }
  57. </script>