用于创建数据驱动组件的简洁、灵活的前端框架:Regularjs

jopen 10年前

Regularjs是一个用于创建数据驱动组件的简洁、灵活的前端框架,拥有强大的实时模板引擎帮助我们创建交互式组件。基于MVVM 模式创建组件。数据绑定,指令,过滤器,事件和动画...都支持开箱即用简洁的API。完全自成一体,易于集成和封装好。使其对大项目友好。
regular-icon-neg.png

特性:

  1. data-binding based on dirty-check
  2. string-based template
  3. independent lifecycle —— can be integrated with whatever framework you already used.
  4. nested component
  5. class-based component. just like angular-classy do for angular
  6. powerfull animation supported (blog)
  7. directive, filter, event is supported, and extend easily.

template

{{#list notes as c}}    <p>{{c.content}}<a href='#' on-click={{this.remove(c)}}>remove</a></p>  {{/list}}  <textarea r-model={{draftComment}}></textarea>  <button on-click={{this.add()}}>new Note</button>

javascript

var NoteApp = Regular.extend({    template: "#todos",    remove: function(index){      this.data.notes.splice(index,1);    },    add: function(){      var data = this.data;      data.notes.push({ content: data.draftComment})      data.draftComment = "";    }  });    new NoteApp({ data: {notes:[] }}).inject(document.body);

项目主页:http://www.open-open.com/lib/view/home/1408606062334