在此tutorial here ,其中有 3 个,我看到他们从模型中调用 View 。
在我见过的所有图表中,都应该有一个 Controller 来协调这种交互。
我不是在提示,但他们是否违反了严格的 MVC 模式?
就跟踪依赖关系而言, Controller 应该依赖于模型和 View 。
模型和 View 应该彼此独立,并且独立于 Controller 。
Backbone 是否打破了 MVC 模式?
最佳答案
无论如何,Backbone 都不是 MVC。 View 充当 Controller ,违背了 MVC 关注点分离的目的。
( View / Controller )还包含在严格的 MVC 中保留在模型中的逻辑。
来自常见问题解答 http://backbonejs.org/#FAQ-mvc
How does Backbone relate to "traditional" MVC? Different implementations of the Model-View-Controller pattern tend to disagree about the definition of a controller. If it helps any, in Backbone, the View class can also be thought of as a kind of controller, dispatching events that originate from the UI, with the HTML template serving as the true view. We call it a View because it represents a logical chunk of UI, responsible for the contents of a single DOM element.
关于javascript - backbone.js 是什么类型的架构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12647118/