fix an event propagate bug #1839
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
英文实在不好,还是用中文解释一下吧,请见谅
在events里面最近我的项目遇到了一个小坑,大概是这个样一个结构:
目前表现现状是当child1的
confirm-ok事件触发时,parent的confirm-ok事件也被同步触发(这里的代码按照官网说明理应不被触发才对)在这样一个需要父级中转的事件中,在child1被触发
confirm-ok时,需要先触发refreshComponent事件,通过父级中转会之后,因为之前在events.js中98行得到是否继续向上触发的结果之前,本身又被父级转发的refreshComponet事件导致自身_shouldPropagate为true(events.js第91行).事件
refreshComponent触发完毕后,执行到events.js99行时,此时的_shouldPropagate结果本应该是fase,但是由于上一次事件传递的影响这里的_shouldPropagate并不是正确的值。故我认为应该在这里增加一下对
_shouldPropagate的重新赋值以得到正确的结果谢谢