gui-article-list.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="gui-article-list">
  3. <view class="gui-article-list-item" hover-class="gui-tap"
  4. :style="itemStyle"
  5. v-for="(item, index) in articles" :key="index"
  6. @tap="newstap(item.id)">
  7. <view>
  8. <text class="gui-article-list-title gui-block-text"
  9. :style="titleStyle">{{item.title}}</text>
  10. </view>
  11. <view class="gui-article-list-img1"
  12. v-if="item.imgs.length == 1">
  13. <gui-image :src="item.imgs[0]" :width="440" :height="280"></gui-image>
  14. </view>
  15. <view class="gui-flex gui-rows gui-nowrap gui-space-between"
  16. v-if="item.imgs.length == 2">
  17. <view class="gui-article-list-img2-in">
  18. <gui-image :src="item.imgs[0]" :width="335" :height="200"></gui-image>
  19. </view>
  20. <view class="gui-article-list-img2-in">
  21. <gui-image :src="item.imgs[1]" :width="335" :height="200"></gui-image>
  22. </view>
  23. </view>
  24. <view class="gui-flex gui-rows gui-nowrap gui-space-between"
  25. v-if="item.imgs.length >= 3">
  26. <view class="gui-article-list-img3-in">
  27. <gui-image :src="item.imgs[0]" :width="220" :height="150"></gui-image>
  28. </view>
  29. <view class="gui-article-list-img3-in">
  30. <gui-image :src="item.imgs[1]" :width="220" :height="150"></gui-image>
  31. </view>
  32. <view class="gui-article-list-img3-in">
  33. <gui-image :src="item.imgs[2]" :width="220" :height="150"></gui-image>
  34. </view>
  35. </view>
  36. <view class="gui-article-list-footer gui-flex gui-rows gui-space-between gui-align-items-center">
  37. <text class="gui-article-list-footer-items gui-ellipsis gui-color-gray gui-block-text gui-icons">&#xe69e; {{item.author}}</text>
  38. <text class="gui-article-list-footer-items gui-ellipsis gui-color-gray gui-block-text gui-icons gui-text-center">&#xe609; {{item.views}}</text>
  39. <text class="gui-article-list-footer-items gui-ellipsis gui-color-gray gui-block-text gui-icons gui-text-right">&#xe64c; {{item.createTime}}</text>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default{
  46. name : "gui-article-list",
  47. props : {
  48. articles : { type : Array , default : function(){return [];}},
  49. titleStyle : { type : String, default : 'lineHeight:44rpx;font-size:32rpx;color:#2B2E3D;'},
  50. itemStyle : { type : String, default : 'background-color:#FFFFFF;'}
  51. },
  52. methods : {
  53. newstap : function(id){
  54. this.$emit('newstap', id);
  55. }
  56. }
  57. }
  58. </script>
  59. <style scoped>
  60. .gui-article-list{}
  61. .gui-article-list-item{margin-bottom:30rpx; padding:20rpx 30rpx;}
  62. .gui-article-list-title{overflow:hidden;}
  63. .gui-article-list-img1{margin-top:22rpx;}
  64. .gui-article-list-img2-in{width:335rpx; height:200rpx; margin-top:22rpx;}
  65. .gui-article-list-img3-in{width:220rpx; height:150rpx; margin-top:22rpx;}
  66. .gui-article-list-footer{margin-top:20rpx;}
  67. .gui-article-list-footer-items{width:220rpx; height:50rpx; line-height:50rpx; font-size:26rpx; overflow:hidden;}
  68. </style>