用于创建数据驱动组件的简洁、灵活的前端框架:Regularjs
jopen
10年前
Regularjs是一个用于创建数据驱动组件的简洁、灵活的前端框架,拥有强大的实时模板引擎帮助我们创建交互式组件。基于MVVM 模式创建组件。数据绑定,指令,过滤器,事件和动画...都支持开箱即用简洁的API。完全自成一体,易于集成和封装好。使其对大项目友好。
特性:
- data-binding based on dirty-check
- string-based template
- independent lifecycle —— can be integrated with whatever framework you already used.
- nested component
- class-based component. just like angular-classy do for angular
- powerfull animation supported (blog)
- 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);