templateA.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view class="container article-list">
  3. <view class="section clearfix" 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: 702rpx;
  60. height: 250rpx;
  61. background: #ffffff;
  62. margin-bottom: 24rpx;
  63. box-sizing: border-box;
  64. padding: 24rpx;
  65. border-radius: 16rpx;
  66. .cover {
  67. float: left;
  68. width: 202rpx;
  69. height: 202rpx;
  70. margin-right: 20rpx;
  71. }
  72. .article-text {
  73. width: 432rpx;
  74. float: left;
  75. .title {
  76. font-size: 26rpx;
  77. height: 37rpx;
  78. color: #3a3a3a;
  79. margin-bottom: 18rpx;
  80. }
  81. .content {
  82. font-size: 24rpx;
  83. line-height: 38rpx;
  84. color: #8a8a8a;
  85. word-break: break-all;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. display: -webkit-inline-box;
  89. -webkit-line-clamp: 4;
  90. -webkit-box-orient: vertical;
  91. }
  92. }
  93. }
  94. }
  95. </style>