Home.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div
  3. id="home"
  4. class="full-width"
  5. >
  6. <header>
  7. <h1>Les Guides de Paris</h1>
  8. <h2>Corpus des XVII et XVIII<sup>E</sup> siècles</h2>
  9. </header>
  10. <section class="row">
  11. <div class="col-2" />
  12. <div class="col-8 teasers">
  13. <div class="wrapper">
  14. <template v-if="!colophonHome || colophonHome.length <= 0">
  15. <span class="loading">Chargement ...</span>
  16. </template>
  17. <template v-else>
  18. <article
  19. v-for="page in colophonHome"
  20. :key="page.uuid"
  21. >
  22. <!-- <h1>{{ page.title }}</h1> -->
  23. <div v-html="trimedTei(page.tei)" />
  24. <a
  25. :href="page.url"
  26. class="readmore"
  27. @click.prevent="onclick(page.uuid)"
  28. @keyup.enter="onclick(page.uuid)"
  29. >
  30. <span>Lire la suite</span>
  31. </a>
  32. </article>
  33. </template>
  34. </div>
  35. </div>
  36. <div class="col-2" />
  37. </section>
  38. </div>
  39. </template>
  40. <script>
  41. import { mapState, mapActions } from 'vuex'
  42. import truncate from 'truncate-html'
  43. export default {
  44. name: 'Home',
  45. metaInfo: {
  46. title: 'Home'
  47. },
  48. // data: () => ({
  49. // // editionslist: []
  50. // }),
  51. computed: {
  52. ...mapState({
  53. colophonHome: state => state.Colophon.colophonHome
  54. })
  55. },
  56. created () {
  57. if (!this.colophonHome.length) {
  58. this.getColophon()
  59. }
  60. },
  61. methods: {
  62. ...mapActions({
  63. getColophon: 'Colophon/getColophon'
  64. }),
  65. trimedTei (tei) {
  66. return truncate(tei, 30, {
  67. byWords: true,
  68. stripTags: false,
  69. reserveLastWord: 10
  70. })
  71. },
  72. onclick (uuid) {
  73. console.log('clicked on home teaser', uuid)
  74. this.$router.push({
  75. name: uuid
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss">
  82. // a{
  83. // z-index: 100;
  84. // }
  85. </style>