v2.0.0-rc.4 for both
https://jsfiddle.net/matiascx/32gu7u00/2/
全局bus需要你自己在destroyed钩子里$off。当时文档里没写,我看到忘了补,现在去补上。
(edit: Sorry for forgetting to use English, because I somehow remembered OP to be speaking Chinese.... For English version see below)
English: OP created an event bus manually and registered events to it. He has to take care to remove those events registrations again when the component gets destroyed, in the beforeDestroy or destroyed hook, because Vue cannot be responsible for events you manually set up with an event bus.
@fnlctrl ,多谢你的指点,确实如你所说,bug fixed
@LinusBorg ,thanks for your information, i have added the event de-registering function in the beforeDestroy hook, that works pretty well now!~
Most helpful comment
English: OP created an event bus manually and registered events to it. He has to take care to remove those events registrations again when the component gets destroyed, in the
beforeDestroyordestroyedhook, because Vue cannot be responsible for events you manually set up with an event bus.