Home.vue 1.7 KB

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