gpt4 book ai didi

javascript - Ember Actions 冒泡流

转载 作者:行者123 更新时间:2023-11-30 17:29:59 25 4
gpt4 key购买 nike

我有一个模板“wheels”,使用 {{render}} 包含在“index”模板中。

轮子模板中有一个带有“rotateWheels” Action 的按钮。

我的基本理解是,当 Action 被触发时, Action 从模板 --> Controller --> 路由 --> 到上层模板 Controller 和路由,直到应用程序 Controller 和路由。事件冒泡并在 ApplicationRoute 结束。

在我的例子中,冒泡路径是:Wheels Controller --> Index Controller --> Index Route --> Application Route

这是 - Jsbin-link

我不清楚为什么冒泡路径不同。

最佳答案

这对我来说很好。车轮路线被跳过,因为您没有使用车轮路线。如果您通过路线图 (http://emberjs.jsbin.com/zirus/1/edit) 访问它,则冒泡路径会通过 Wheels Route。不会访问其他 Controller ,因为操作会通过其他路由而不是 Controller 冒泡。请参阅 http://emberjs.com/guides/templates/actions/ 上的图表.

关于javascript - Ember Actions 冒泡流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23339208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com