用于創建數據驅動組件的簡潔、靈活的前端框架:Regularjs
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);
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!