list.vue 1.1 KB

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