Can I emit from mounted in Wuijs?
1 answer
When you add an event handler to the parent's lifecycle event mounted
for an event that is emitted in the child event mounted
, the handler will not catch the event emitted by the child, because the handler is added after the child has already selected the event. Basically, the event loop looks like this.
- Parent creates
- Child creates
- Fixed child
- Parental setting
Obviously, other life cycle events are happening, but the sequence that matters in this case.
If you want to handle an event fired on a child, you need to create a handler (call $ on) before the child event mounted
.
+4
source to share