templateC.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <scroll-view scroll-x="true" class="container article-list">
  3. <view class="section" v-for="(item,index) in productList" :key="index" @click="navigaitionTo(item)">
  4. <view class="cover">
  5. <image :src="item.appletsImage" class="cover-gg"></image>
  6. </view>
  7. <view class="article-text">
  8. <view class="title">{{item.name}}</view>
  9. <view class="content" v-text="item.content"></view>
  10. </view>
  11. </view>
  12. </scroll-view>
  13. </template>
  14. <script>
  15. import caimeiApi from '@/common/config/caimeiApi.js'
  16. export default {
  17. data(){
  18. return{
  19. productList:[]
  20. }
  21. },
  22. props:{
  23. pageData: {
  24. type: Object
  25. },
  26. userIdentity: {
  27. type: Number
  28. }
  29. },
  30. created() {
  31. this.initData(this.pageData)
  32. },
  33. methods:{
  34. initData(data){
  35. this.productList = data.floorImageList
  36. },
  37. navigaitionTo(item){
  38. if(item.link){
  39. uni.navigateTo({
  40. url: `/pages/h5/article/path?link=${item.link}`
  41. })
  42. }
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. .article-list {
  49. width: 750rpx;
  50. margin-left: -24rpx;
  51. height: auto;
  52. box-sizing: border-box;
  53. white-space: nowrap;
  54. .section {
  55. display: inline-block;
  56. width: 310rpx;
  57. height: 392rpx;
  58. background: #ffffff;
  59. box-sizing: border-box;
  60. border-radius: 16rpx;
  61. margin-right: 24rpx;
  62. vertical-align: middle;
  63. &:first-child{
  64. margin-left: 24rpx;
  65. }
  66. .cover {
  67. width: 310rpx;
  68. height: 220rpx;
  69. border-radius: 16rpx 16rpx 0 0;
  70. overflow: hidden;
  71. .cover-gg{
  72. width: 310rpx;
  73. height: 220rpx;
  74. }
  75. }
  76. .article-text {
  77. width: 310rpx;
  78. box-sizing: border-box;
  79. padding: 24rpx;
  80. .title {
  81. font-size: 26rpx;
  82. height: 37rpx;
  83. color: #3a3a3a;
  84. margin-bottom: 16rpx;
  85. word-break: break-all;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. display: -webkit-box;
  89. -webkit-line-clamp: 1;
  90. -webkit-box-orient: vertical;
  91. }
  92. .content {
  93. white-space: normal;
  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-box;
  101. -webkit-line-clamp: 2;
  102. -webkit-box-orient: vertical;
  103. }
  104. }
  105. }
  106. }
  107. </style>