在子组件里是不会触发的 要写在父组件中
父组件中这样写:
<goods ref="goods"></goods>
onReachBottom(){
console.log('onReachBottom1111111111');
if(this.$refs.goods){
if(this.$refs.goods.status === 'loadmore') {
this.$refs.goods.getNoSaleList();
}
}
}
然后子组件里添加样式
<style lang="scss" >
page{
height: auto !important
}
</style>
在子组件里卡了半天,还以为是高度问题
看别的帖子说过,page{ height: 101%}可以解决,有写过样式的小伙伴也可以试试
pages.json 也可以加 onReachBottomDistance试试看( onReachBottomDistance 默认是50)
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#1097FF",
"backgroundColor": "#1097FF",
"onReachBottomDistance": 200
// "navigationStyle": "custom"
}
还有就是微信小程序写代码的 onReachBottom方法可能是自动生成的,有可能有两个onReachBottom方法。
查了那么久,大概可能出现的问题都写了。
有这些问题的小伙伴可以试试看