Item.vue 985 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <li class="header-comments__item">
  3. <NewsLink :news="comment.news">
  4. <div class="header-comments-item">
  5. <a class="header-comments-item__link" href="javascript:void(0)">
  6. <div class="header-comments-item__top">
  7. <div class="header-comments-item__text">{{ textWithoutHtml }}</div>
  8. </div>
  9. <div class="header-comments-item__bottom">
  10. <div class="header-comments-item__title" v-html="comment.news.name"></div>
  11. <div class="header-comments-item__time">
  12. {{ $convertDate(comment.create) }}
  13. </div>
  14. </div></a
  15. >
  16. </div>
  17. </NewsLink>
  18. </li>
  19. </template>
  20. <script>
  21. export default {
  22. props: {
  23. comment: {
  24. type: Object,
  25. },
  26. },
  27. computed: {
  28. textWithoutHtml() {
  29. return this.comment.text.replaceAll(/(<([^>]+)>)/ig, '')
  30. }
  31. }
  32. };
  33. </script>
  34. <style lang="less">
  35. .header-comments-item__text {
  36. line-height: 16px;
  37. max-height: 32px;
  38. overflow: hidden;
  39. }
  40. </style>