javascript - backbone.js 是什么类型的架构?

标签 javascript backbone.js

在此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/

相关文章:

backbone.js - Backbone Stickit 输入值从外部更改

javascript - Marionette.js ItemView - 将 subview 放入区域

javascript - 谷歌回调API

javascript - 在客户端 PC 上启动 MS Word 以编辑服务器上的文档

javascript - 正则表达式确保有效的查询字符串

javascript - 反复左右滑动div

javascript - 我该如何重写这段代码

javascript - 无法使 grunt-postcss 和 autoprefixer 工作

javascript - Webgl Globe 在本地不工作

javascript - 主干 View 未定义