JavaScript 框架:ConstraintJS
ConstraintJS 是一個用來開發動態 Web 應用的 JavaScript 框架。
<label>Title:</label> <input class='form-control' type='text' cjs-out='demonym' placeholder='Demonym' value='Commander' /> <label>Members (comma-separated):</label> <input class='form-control' type='text' cjs-out='items' placeholder='Comma-separated items' value='Kirk, Spock, Sulu, Uhura' /> <hr /> <label>Result:</label> <ul class="list-group"> {{#each items.split(",")}} <li class="list-group-item"> <strong>{{demonym}} {{@index}}</strong>: {{this}} </li> {{/each}} </ul> // works with jQuery ($) cjs.createTemplate($("#ex2code"), {}, $("#ex2"));
更干凈的代碼
ConstraintJS enables constraints — relationships that are declared once & automatically maintained. These constraints can make writing dynamic apps easier.
輕量級
ConstraintJS is small (about 10kb) and works well with other JavaScript libraries like jQuery.
簡單的語法
ConstraintJS's API is very learnable and includes features for dynamic handlebars-like templates.
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!