我是否有理由使用 Knockout MVC 而不是 Knockout JS?

编程入门 行业动态 更新时间:2024-10-22 17:28:29
本文介绍了我是否有理由使用 Knockout MVC 而不是 Knockout JS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

另一位用户建议Knockout MVC 来处理一些 AJAX 发布问题.我读了一点,我发现它是 Knockout JS 的包装器.所以我想知道两者之间的真正区别是什么?我是否应该为 Knockout JS 而烦恼,因为 Knockout MVC 存在吗?我什么时候会使用一个?

Another user suggested Knockout MVC to handle some AJAX posting issues. I read a little on it and I see it is a wrapper around Knockout JS. So I wonder what are the real differences between the two? Should I bother with Knockout JS since Knockout MVC exists? When would I use one over the other?

推荐答案

Knockout MVC 是 WebForms 的私生子.它通过控制器操作路由所有视图模型方法,这意味着发生的一切都必须反弹到服务器并返回.我不明白为什么有人会采用像 Knockout 这样的框架,它旨在成为客户端 MVVM,并强制它为每个功能调用服务器.

Knockout MVC is the bastard child of WebForms. It routes all viewmodel methods through controller actions, meaning everything that happens has to bounce to the server and back. I cannot understand why anyone would take a framework like knockout, which is intended to be CLIENT SIDE MVVM, and force it to call the server for every function.

此外,在服务器上执行这些方法意味着对于每个函数调用,整个视图模型都需要传递给服务器,然后返回给客户端.这太浪费了.

In addition, performing those methods on the server means the entire viewmodel needs to be passed to the server, and back to the client, for every function call. This is incredibly wasteful.

使用 Knockout MVC 意味着为了不必编写 javascript 的好处而牺牲客户端代码的所有性能优势.WebForms 做出了同样的权衡.这不是一个好方法.这是一种反模式.

Using Knockout MVC means sacrificing all the performance benefits of client-side code for the benefit of not having to write javascript. The same trade-off WebForms made. It is not a good one. It is an antipattern.

如果 Knockout MVC 明天就消亡,网络将变得更好.

If Knockout MVC dies tomorrow, the web will be a better place.

更多推荐

我是否有理由使用 Knockout MVC 而不是 Knockout JS?

本文发布于:2023-11-29 08:30:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645875.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有理由   而不是   MVC   Knockout   JS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!