ArticleCard.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <article class="card article">
  3. <header>
  4. <h1>
  5. <a
  6. :href="item.view_node"
  7. @click.prevent="onclick"
  8. v-html="item.title"
  9. ></a>
  10. </h1>
  11. <aside v-html="item.created"></aside>
  12. <!-- <h4 class="body" v-html="item.body"></h4> -->
  13. </header>
  14. <section class="images">
  15. <a
  16. :href="item.view_node"
  17. @click.prevent="onclick"
  18. >
  19. <figure v-html="item.field_visuel"/>
  20. </a>
  21. </section>
  22. </article>
  23. </template>
  24. <script>
  25. // import JSONAPI from 'vuejs/api/json-axios'
  26. import router from 'vuejs/route'
  27. let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
  28. export default {
  29. name: "ArticleCard",
  30. router,
  31. props: ['item'],
  32. data(){
  33. return {
  34. alias: this.item.view_node.replace(/^.*\/blabla\//g, '')
  35. }
  36. },
  37. methods:{
  38. onclick(){
  39. console.log('clicked on article', this.alias)
  40. this.$router.push({
  41. name:`article`,
  42. params: { alias:this.alias, id: this.item.nid }
  43. // query: { nid: this.item.nid }
  44. // meta: { uuid:this.item.uuid },
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. </style>