JavaScript的MVC 框架,Mithril.js 0.1.29 发布

jopen 9年前

Mithril.js 0.1.29 发布,现已提供下载(ZIP)。

Mithril.js 是一个客户端的 JavaScript MVC 框架。可将应用分成数据层、UI层和控制层。Mithril 压缩后只有 3kb 左右。API 提供一个模板引擎,带 DOM diff 实现,支持路由和组合。

What is Mithril?

Mithril is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.

Light-weight

  • Only 5kb gzipped, no dependencies
  • Small API, small learning curve

Robust

  • Safe-by-default templates
  • Hierarchical MVC via components

Fast

  • Virtual DOM diffing and compilable templates
  • Intelligent auto-redrawing system
//namespace  var app = {};     //model  app.PageList = function() {      return m.request({method: "GET", url: "pages.json"});  };     //controller  app.controller = function() {      this.pages = app.PageList();  };     //view  app.view = function(ctrl) {      return ctrl.pages().map(function(page) {          return m("a", {href: page.url}, page.title);      });  };     //initialize  m.module(document.getElementById("example"), app);

JavaScript的MVC 框架,Mithril.js 0.1.29 发布

http://lhorie.github.io/mithril/