简体   繁体   English

Ember.js:路由器/路由和StateManager / State之间有什么区别?

[英]Ember.js: Whats the difference between Router / Route and StateManager / State?

It seems like older examples of routing use StateManager and newer examples use the concept of Router . 似乎旧的路由示例使用StateManager和更新的示例使用Router的概念。 What is the difference and why you would use one over the other? 有什么区别以及为什么要使用其中一个?

Router and Route are just subclasses of StateManager and State, originally the routing specific code was added directly to the StateManager code, but in the last few weeks effort has been made to extract it out. 路由器和路由只是StateManager和State的子类,最初路由特定代码直接添加到StateManager代码中,但在过去几周内已经努力将其解压缩出来。

Basically use the Router for the core flow of your app which deals with URLs and so forth, but if you need to use additional state managers in other places in your application, you can use StateManager/State without the extra Routing code being included when it's not needed. 基本上使用路由器处理应用程序的核心流程来处理URL等等,但如果您需要在应用程序的其他位置使用其他状态管理器,则可以使用StateManager / State而不包含额外的路由代码。不需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM