Home.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 v-if="colophonHome.length && colophonHome.length > 0" class="wrapper">
  14. <article
  15. v-for="page in colophonHome"
  16. :key="page.uuid"
  17. >
  18. <!-- <h1>{{ page.title }}</h1> -->
  19. <div v-html="trimedTei(page.tei)" />
  20. <a
  21. :href="page.url"
  22. class="readmore"
  23. @click.prevent="onclick(page.uuid)"
  24. @keyup.enter="onclick(page.uuid)"
  25. >
  26. <span>Lire la suite</span>
  27. </a>
  28. </article>
  29. </div>
  30. </div>
  31. <div class="col-2" />
  32. </section>
  33. </div>
  34. </template>
  35. <script>
  36. import { mapState, mapActions } from 'vuex'
  37. import truncate from 'truncate-html'
  38. export default {
  39. name: 'Home',
  40. metaInfo: {
  41. title: 'Home'
  42. },
  43. // data: () => ({
  44. // // editionslist: []
  45. // }),
  46. computed: {
  47. ...mapState({
  48. colophonHome: state => state.Colophon.colophonHome
  49. })
  50. },
  51. created () {
  52. if (!this.colophonHome.length) {
  53. this.getColophon()
  54. }
  55. },
  56. methods: {
  57. ...mapActions({
  58. getColophon: 'Colophon/getColophon'
  59. }),
  60. trimedTei (tei) {
  61. return truncate(tei, 30, {
  62. byWords: true,
  63. stripTags: false,
  64. reserveLastWord: 10
  65. })
  66. },
  67. onclick (uuid) {
  68. console.log('clicked on home teaser', uuid)
  69. this.$router.push({
  70. name: uuid
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. // a{
  78. // z-index: 100;
  79. // }
  80. </style>