ArticleCard.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <el-col style="padding-right: 7px; padding-left: 7px">
  3. <div style="cursor: pointer" :title="article.title">
  4. <el-card class="box-card">
  5. <div slot="header" class="clearfix">
  6. <el-row>
  7. <router-link target="_blank" :to="`/article/${article.articleId}`">
  8. <span style="left: 0;margin-bottom: 0px;color: black;">{{ article.title | ellipsis }}</span>
  9. </router-link>
  10. </el-row>
  11. </div>
  12. <div class="text item">
  13. <el-row>
  14. <span v-html="article.excerpt"/>
  15. </el-row>
  16. </div>
  17. </el-card>
  18. </div>
  19. </el-col>
  20. </template>
  21. <script>
  22. export default {
  23. name: 'ArticleCard',
  24. filters: {
  25. ellipsis(value) {
  26. if (!value) return ''
  27. const max = 10
  28. if (value.length > max) {
  29. return value.slice(0, max) + '...'
  30. }
  31. return value
  32. }
  33. },
  34. props: {
  35. article: {
  36. type: Object,
  37. default: null
  38. },
  39. // 时间前的描述
  40. dateTit: {
  41. type: String,
  42. default: ''
  43. }
  44. },
  45. methods: {
  46. }
  47. }
  48. </script>
  49. <style scoped>
  50. /*处于手机屏幕时*/
  51. @media screen and (max-width: 768px) {
  52. }
  53. .clearfix:before,
  54. .clearfix:after {
  55. display: table;
  56. content: "";
  57. }
  58. .clearfix:after {
  59. clear: both;
  60. }
  61. </style>