hilongjw / vue-lazyload

A Vue.js plugin for lazyload your Image or Component in your application.
http://hilongjw.github.io/vue-lazyload/
MIT License
7.98k stars 865 forks source link

slot 内不能正常监听 components 事件 #424

Open zackery-chung opened 4 years ago

zackery-chung commented 4 years ago

slot 内不能正常监听事件

例子:

<lazy-component>
  <div>
    <MyComp @hi="sayHi"></MyComp>
  </div>
</lazy-component>

sayHi 无法正常触发

原因:

因为lazy-components render问题,加载后 根节点 变更了,原节点被新节点替换了,导致组件缓存的$el, 组件被销毁

lazy-component.js

image

lazy.js

image

修复:

422