imgList.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="list">
  3. <uni-card padding="0" spacing="0" type="line">
  4. <template v-slot:cover>
  5. <view class="custom-cover">
  6. <image class="cover-image" mode="aspectFill" :src="cover">
  7. </image>
  8. <view class="cover-content">
  9. <text class="uni-subtitle uni-white">{{ name }}</text>
  10. </view>
  11. </view>
  12. </template>
  13. <uni-list>
  14. <uni-list-item v-for="(item, index) in data" :key="index" :title="item.title" showArrow
  15. @click="onClick"
  16. :thumb="`${baseurl}${item.thumbnail}`"
  17. thumb-size="lg" rightText="详情" />
  18. </uni-list>
  19. </uni-card>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. props: {
  25. // 数据内容
  26. data: { type: Array, default: () => [] },
  27. name: { type: String, default: '默认title' },
  28. // 图片地址
  29. cover: { type: String, default: '' }
  30. },
  31. computed: {},
  32. data() {
  33. return {
  34. baseurl: 'http://192.168.0.45:9002',
  35. };
  36. },
  37. async mounted() {},
  38. methods: {
  39. async onClick(e) {
  40. console.log(e);
  41. }
  42. },
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. .cover-image {
  47. width: 100%;
  48. height: 150px;
  49. }
  50. .cover-content {
  51. position: absolute;
  52. top: 35%;
  53. width: 100%;
  54. background: #000;
  55. opacity: 0.5;
  56. }
  57. .uni-subtitle {
  58. line-height: 30px;
  59. margin-left: 10px;
  60. }
  61. .list {
  62. margin-top: 15px;
  63. }
  64. </style>