page.vue
<script setup lang="ts">  
import { onReachBottom } from '@dcloudio/uni-app'  
import TestComponent from './TestComponent.vue'  
// 必须调用, 否则组件内的onReachBottom不会触发  
onReachBottom(() => {  
  console.log('onReachBottom by page')  
})  
</script>  
<template>  
  <TestComponent />  
</template>TestComponent.vue
<script setup lang="ts">  
import { onReachBottom } from '@dcloudio/uni-app'  
onReachBottom(() => {  
  console.log('onReachBottom by component')  
})  
</script>  
<template>  
  <view :style="{ height: '200vh' }" />  
</template> 
             
             
             
			 
                                        
                                     
                                                                     
                                                                    


![[已删除]](https://img-cdn-tc.dcloud.net.cn/account/identicon/6e45f66ba48cf70e14e48b4b8bbc866f.png) 
                                                                     
                                                                     
            
4***@qq.com
VUE2组件内还是无效
2024-11-01 13:08