Home.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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-3" />
  12. <div class="col-6 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. >
  24. <span>Lire la suite</span>
  25. </a>
  26. </article>
  27. </div>
  28. <div class="col-3" />
  29. </section>
  30. </div>
  31. </template>
  32. <script>
  33. import { mapState, mapActions } from 'vuex'
  34. import truncate from 'truncate-html'
  35. export default {
  36. name: 'Home',
  37. metaInfo: {
  38. title: 'Home'
  39. },
  40. // data: () => ({
  41. // // editionslist: []
  42. // }),
  43. computed: {
  44. ...mapState({
  45. colophonHome: state => state.Colophon.colophonHome
  46. })
  47. },
  48. created () {
  49. if (!this.colophonHome.length) {
  50. this.getColophon()
  51. }
  52. },
  53. methods: {
  54. ...mapActions({
  55. getColophon: 'Colophon/getColophon'
  56. }),
  57. trimedTei (tei) {
  58. return truncate(tei, 30, {
  59. byWords: true,
  60. stripTags: false,
  61. reserveLastWord: 10
  62. })
  63. },
  64. onclick (uuid) {
  65. console.log('clicked on home teaser', uuid)
  66. this.$router.push({
  67. name: uuid
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. // a{
  75. // z-index: 100;
  76. // }
  77. </style>