ElemeFE / vue-infinite-scroll

An infinite scroll directive for vue.js.
2.86k stars 417 forks source link

看了源码,如果没监听到父级组件的mounted事件,就不会bind,也就是会无效 #114

Open Nomia opened 5 years ago

Nomia commented 5 years ago

如题, 如果父级组件没有触发mounted事件,就不会走到下一步进行滚动的监听,也就没法做到滚动加载。 image mounted一直没有打印出来,当我把nextTick搬到外面来时,也就是不再hook:mounted监听代码块里面,就可以

这是我的代码结构 image

父级组件肯定会先mount,这个时候就不会触发mounted事件。

Nomia commented 5 years ago

image

Nomia commented 5 years ago

vm is already mounted when you listen for its mounted event, so the callback will never be triggered

aimer-fan commented 2 years ago

+1