easyview
Easy jQuery MVVM (model - view - viewmodel) plugin based on jsviews. For markups documentation, see https://www.jsviews.com.
Install
npm install jquery-easyview
Demo
Options
model
Type: Object
Default: {}
Data represents real state content.
model: title: 'My Heroes' selected: null heroes: id: 1 name: 'Windstorm' id: 2 name: 'Bombasto'
events
Type: Object
Default: {}
DOM Events binding specification.
events: 'click button': 'onButtonClick' { if ekeyCode === 13 // ... } { e; // ...}
Example
<!-- part of view --> My Heroes Click on hero to edit {^{for heroes}} {{/for}} {^{if selected}} My Hero Detail Edit hero: {{/if}} <!-- include libraries --> <!-- your script -->
// file: script.js ;
Methods
set()
Set model property value.
// using string as key;; // using jQuery object;
get()
Get model property value
// using string as keyvar hero = ; // using jQuery objectvar hero = ;