Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第十八题:解释一下什么是mvvm,mvc #18

Open
GenXiaoLe opened this issue Sep 2, 2019 · 1 comment
Open

第十八题:解释一下什么是mvvm,mvc #18

GenXiaoLe opened this issue Sep 2, 2019 · 1 comment

Comments

@GenXiaoLe
Copy link
Collaborator

从概念和区别方面解释

@MMmaXingXing
Copy link

MVC

概念

Model View Controller, 是模型-视图-控制器的缩写,一种软件设计典范,用一种业务逻辑、数据、界面显示分离的方式组织代码,将业务聚集在一个部件中,在改进个性化定制界面中以及用户交互的同时,不需要重新编写业务逻辑。

MVC发展起来被用于映射传统的输入、处理、输出功能在一个逻辑的图形化用户界面的结构中。

其中,控制器Controller 是应用程序中处理用户交互的部分,通常负责从视图读取数据,控制用户输入。

MVVM

概念

MVVM是Model-View-ViewModel的缩写,本质上是MVC解构的改进版。MVVM就是将其中View的状态和行为抽象化,让我们将视图UI和业务逻辑分开。ViewModel可以取出Model中的数据同时帮忙处理View中由于需要展示内容而设涉及的业务逻辑。

其中:由于VM的出现,很大程度上减轻了controller的体积,VM负责处理整理好的数据, controller直接管理VM 而不再对原始数据进行管理并处理。

  • 在前端MVVM,直接指代数据双向绑定,而MVC仅仅是一种架构模式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants