collection.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view style="width: 100;height: 100%;background-color: #f6f6f6;padding: 20rpx 30rpx;">
  3. <view class="list" v-for="item,index in listArray" :key='index' @click="open" :data-index="index">
  4. <view class="text">
  5. <view class="title">{{item.title}}</view>
  6. <view class="type">{{item.type}}</view>
  7. </view>
  8. <view class="img">
  9. <image :src="item.img" class="i" mode="aspectFit"></image>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. listArray: [{
  19. title: '钢铁是怎样炼成的',
  20. type: '文章类型',
  21. img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
  22. }, {
  23. title: '成都富婆通讯录',
  24. type: '文章类型',
  25. img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
  26. }, {
  27. title: '迪迦变身器使用手册',
  28. type: '文章类型',
  29. img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
  30. }, {
  31. title: '小红书',
  32. type: '文章类型',
  33. img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
  34. }, {
  35. title: '小黄书',
  36. type: '文章类型',
  37. img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
  38. }, {
  39. title: '金瓶梅',
  40. type: '文章类型',
  41. img: 'https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/横占位图.png'
  42. }]
  43. }
  44. },
  45. methods: {
  46. //点击文章
  47. open(e) {
  48. console.log(this.listArray[e.currentTarget.dataset.index].title)
  49. uni.navigateTo({
  50. url: '/pages/common_tools/collection/collection_details?title=' + this.listArray[e.currentTarget.dataset.index].title
  51. // url: '/pages/customer/customer-datails?n=' + n
  52. })
  53. }
  54. },
  55. }
  56. </script>
  57. <style lang="scss">
  58. //每一条文章
  59. .list {
  60. margin-bottom: 20rpx;
  61. border-radius: 12rpx;
  62. background-color: #ffffff;
  63. padding: 25rpx 20rpx;
  64. display: flex;
  65. box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.04);
  66. .text {
  67. width: 60%;
  68. height: 165rpx;
  69. padding-right: 25rpx;
  70. .title {
  71. height: 80%;
  72. font-size: 30rpx;
  73. font-weight: bold;
  74. // overflow: hidden; //超出一行文字自动隐藏
  75. // text-overflow: ellipsis; //文字隐藏后添加省略号
  76. // white-space: nowrap; //强制不换行
  77. }
  78. .type {
  79. font-size: 26rpx;
  80. color: #666666;
  81. font-weight: 400;
  82. height: 20%;
  83. bottom: 0;
  84. }
  85. }
  86. .img {
  87. width: 40%;
  88. height: 100%;
  89. .i {
  90. width: 272rpx;
  91. height: 157rpx;
  92. }
  93. }
  94. }
  95. </style>