Row.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="news" @click="navigateTo('/pagesNews/Detail?id=' + info.id, false)">
  3. <van-image :src="info.img" fit="cover" width="280rpx" height="200rpx" custom-class="my-img" />
  4. <div class="news-info">
  5. <div class="text1">
  6. <van-tag type="warning" v-if="isList && info.top">置顶</van-tag>
  7. <span> {{ info.title }}</span>
  8. </div>
  9. <p>{{ info.createdAt }}</p>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. info: {
  17. type: Object,
  18. default: () => {
  19. return {};
  20. }
  21. },
  22. isList: {
  23. type: Boolean,
  24. default: false
  25. }
  26. },
  27. data() {
  28. return {};
  29. }
  30. };
  31. </script>
  32. <style lang="less" scoped>
  33. .news {
  34. display: flex;
  35. background-color: @bgw;
  36. border-radius: 4px;
  37. overflow: hidden;
  38. .news-info {
  39. padding: 12px 10px;
  40. flex-grow: 1;
  41. overflow: hidden;
  42. .text1 {
  43. display: -webkit-box;
  44. -webkit-box-orient: vertical;
  45. -webkit-line-clamp: 2;
  46. overflow: hidden;
  47. font-size: 16px;
  48. color: #000000;
  49. line-height: 24px;
  50. ._van-tag {
  51. vertical-align: middle;
  52. }
  53. span {
  54. vertical-align: middle;
  55. }
  56. }
  57. p {
  58. color: #acb3bf;
  59. margin-top: 6px;
  60. }
  61. }
  62. // &:active {
  63. // background-color: darken(#fff, 10);
  64. // }
  65. }
  66. .text1 {
  67. ._van-tag {
  68. vertical-align: middle;
  69. height: 16px;
  70. display: inline-block;
  71. margin-right: 3px;
  72. line-height: 32rpx;
  73. --tag-warning-color: #ef8207;
  74. }
  75. span {
  76. vertical-align: middle;
  77. }
  78. }
  79. </style>
  80. <style lang="less">
  81. .my-img {
  82. --image-placeholder-background-color: #ccc;
  83. }
  84. </style>