Index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <Layout>
  3. <!-- Mise en page -->
  4. <div v-for="edge in $page.introductions.edges.slice().reverse()" :key="`introductions${edge.node.id}`">
  5. <VueMarkdown
  6. class="chapter-content justify"
  7. >{{edge.node.contenu}}
  8. </VueMarkdown>
  9. </div>
  10. <!-- Sommaire -->
  11. <div class="column no-folio">
  12. <div class="section-title">
  13. Sommaire
  14. </div>
  15. <div class="column justify-end table-of-content">
  16. <span
  17. v-for="edge in $page.chapitres.edges.slice().reverse()"
  18. :key="`sommaire${edge.node.id}`"
  19. >
  20. <a :href="'#chapitres'+edge.node.id">{{ edge.node.Titre }}</a>
  21. </span>
  22. </div>
  23. </div>
  24. <div v-for="edge in $page.chapitres.edges.slice().reverse()" :key="`chapitres${edge.node.id}`">
  25. <h2
  26. :id="`chapitres${edge.node.id}`"
  27. class="chapter-title canbreak"
  28. >{{edge.node.titre}}</h2>
  29. <VueMarkdown
  30. class="chapter-content justify"
  31. >{{edge.node.contenu}}
  32. </VueMarkdown>
  33. </div>
  34. </Layout>
  35. </template>
  36. <script>
  37. import { Previewer } from 'pagedjs'
  38. import VueMarkdown from 'vue-markdown'
  39. export default {
  40. components: {
  41. VueMarkdown
  42. },
  43. mounted(){
  44. this.$nextTick(()=>{
  45. let previewer = new Previewer();
  46. previewer.preview();
  47. })
  48. }
  49. }
  50. </script>
  51. <page-query>
  52. query {
  53. chapitres: allChapitres {
  54. edges {
  55. node {
  56. id
  57. Titre
  58. Contenu
  59. }
  60. }
  61. }
  62. introductions: allIntroductions {
  63. edges {
  64. node {
  65. id
  66. contenu
  67. }
  68. }
  69. }
  70. }
  71. </page-query>