JavaScript中的mvc是什么
我多次听说过javascript中的mvc,但是我不知道mvc在js中是如何工作的。
由于我使用了goolge map v3,并且我找到了 MVCObject。
看起来这是一个辅助类,用于注册和侦听对象的属性更改事件。
我认为这应该是“模型”,但是我还没有在那里找到“MVCView”。
我真的很困惑。
任何人都可以给我更多详细信息吗?
I heard of mvc in javascript many times,however I have no idea about how the mvc work in js.
Since I have used the goolge map v3,and I found the MVCObject.
It seems that this is a helper class used for register and listener the property chang event of the object.
I thinks this should be the "Model", Howver I have not found the "MVCView" there.
I am really confused with that.
Anyone can give me more details?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(2)
在 javascript 中,视图主要是由 js 中的某些视图类呈现的一些 html 模板。模型是一个绑定到该视图的类,以便在渲染时,来自该模型的数据被加载到模板中的正确位置。例如,看看 backbone.js 。
In javascript the view is mostly some html template that is rendered by some view class in js. The model is a class that is bound to that view so that, when it renders, the data from that model is being loaded on the correct positions in the templates. Take a look at backbone.js for example.
以下是 MVC 模式如何工作的高级简要概述:
控制器:
模型:
视图:
模型。
需要注意的几件事是模型不能直接与视图通信,反之亦然。只有控制器可以与视图和模型通信,因此控制器充当从浏览器上的用户交互中检索的交互/事件的委托者。
Here's a brief overview at a high level on how the MVC Pattern works:
Controller:
Model:
View:
Model.
A couple of things to note is that models can't communicate with views directly and vise versa. Only the controller can communicate with the view and model, so the controller acts as the delegator for the interaction/event retrieved from users interaction on the browser.