templateD.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="container article-list clearfix">
  3. <view class="section" v-for="(item,index) in productList" :key="index" @click="navigaitionTo(item)">
  4. <image :src="item.adsImage" mode="aspectFit" class="cover"></image>
  5. <view class="article-text">
  6. <view class="title">{{item.name}}</view>
  7. <view class="content" v-text="item.content"></view>
  8. </view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data(){
  15. return{
  16. productList:[]
  17. }
  18. },
  19. props:{
  20. pageData: {
  21. type: Object
  22. },
  23. userIdentity: {
  24. type: Number
  25. },
  26. flag:{
  27. type:Boolean,
  28. default:false
  29. }
  30. },
  31. created() {
  32. this.initData(this.pageData);
  33. },
  34. methods:{
  35. initData(data){
  36. if(this.flag){
  37. this.productList = data.floorImageList
  38. }else{
  39. this.productList = data.floorImageList.slice(0,4);
  40. }
  41. },
  42. navigaitionTo(item){
  43. console.log(item);
  44. if(item.link){
  45. uni.navigateTo({
  46. url:`/h5/pages/article/path?link=${item.link}`
  47. })
  48. }
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .article-list {
  55. width: 100%;
  56. height: auto;
  57. box-sizing: border-box;
  58. .section {
  59. width: 339rpx;
  60. height: 412rpx;
  61. background: #ffffff;
  62. box-sizing: border-box;
  63. border-radius: 16rpx;
  64. float: left;
  65. margin-right: 24rpx;
  66. margin-top: 24rpx;
  67. &:nth-child(2n){
  68. margin-right: 0;
  69. }
  70. &:nth-child(1),&:nth-child(2){
  71. margin-top: 0;
  72. }
  73. .cover {
  74. width: 339rpx;
  75. height: 240rpx;
  76. border-radius: 16rpx 16rpx 0 0;
  77. overflow: hidden;
  78. .cover-gg{
  79. width: 339rpx;
  80. height: 240rpx;
  81. }
  82. }
  83. .article-text {
  84. width: 339rpx;
  85. box-sizing: border-box;
  86. padding: 24rpx;
  87. .title {
  88. font-size: 26rpx;
  89. height: 37rpx;
  90. color: #3a3a3a;
  91. margin-bottom: 16rpx;
  92. }
  93. .content {
  94. font-size: 24rpx;
  95. line-height: 40rpx;
  96. color: #8a8a8a;
  97. word-break: break-all;
  98. overflow: hidden;
  99. text-overflow: ellipsis;
  100. display: -webkit-inline-box;
  101. -webkit-line-clamp: 2;
  102. -webkit-box-orient: vertical;
  103. }
  104. }
  105. }
  106. }
  107. </style>