Is there a JavaScript MVC (micro-)framework? [clos

2019-01-03 19:30发布

Are there any client-side JavaScript MVC (micro-)frameworks?

I have a rather complicated HTML form, and it would benefit from the MVC pattern.

I imagine a good solution would provide the following:

  • Model and View update the Controller when values change (Observer pattern)
  • Populate the model from the form data when the page loads
  • Populate the form from the model when the model changes

Ajax, comet, JSONP and all that jazz are serious overkill.

30条回答
▲ chillily
2楼-- · 2019-01-03 19:51

There is the popular Backbone.js

查看更多
何必那么认真
4楼-- · 2019-01-03 19:52

Spine has an API similar to Backbone but it's a lot smaller. It features prototypal inheritance.

查看更多
何必那么认真
5楼-- · 2019-01-03 19:53

JavaScriptMVC is an excellent solution. It's everything is a plugin approach enables you to select only the features you need. As of 2.0, it's based on jQuery.

On progressively enhancing your website, that's left up to the user as JMVC provides just a middle layer for development - it's up to you to make that design choice yourself.

However, JavaScriptMVC is simply the best general purpose JavaScriptMVC library because of its powerful event delegation based controllers.

Event delegation lets you escape having to attach event handlers, and simply create rules for your page.

Finally, JMVC is much more than a MVC architecture. It has all parts of the development cycle covered with:

  • Code Generators
  • Selenium and Env.js integrated testing
  • Documentation Engine
  • Automatic Concat+Compress
  • Error detection and reporting
查看更多
▲ chillily
6楼-- · 2019-01-03 19:53

Try kitty. It is only 1.4KB and its only dependency is EJS.

查看更多
不美不萌又怎样
7楼-- · 2019-01-03 19:53

There was a key-value binding JavaScript framework called "Coherent", which was inspired by Apple's Cocoa Bindings. The framework has been bought by Apple, but there is still an old copy at http://github.com/trek/coherentjs/tree/master.

查看更多
登录 后发表回答