custom-list-item.uvue 628 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<template>
  <view ref="box" class="custom-list-item-box">
    <slot></slot>
  </view>
</template>

<script>
  export default {
    name: "custom-list-item",
    props: {
      item: {
        type: Object as PropType<any>,
        required: true
      }
    },
    inject: {
17 18
      setCachedSize: {
        type: Function as PropType<(item : any, size : number) => void>
19 20 21
      },
    },
    mounted() {
22 23
      uni.createSelectorQuery().in(this).select('.custom-list-item-box').boundingClientRect().exec((ret) => {
        this.setCachedSize(this.item, (ret[0] as NodeInfo).height!)
24 25 26 27 28 29 30
      })
    }
  }
</script>

<style>

31
</style>