vmlib
v0.0.2
Published
Vm.js ============ Simple ViewModel
Downloads
1
Readme
Vm.js
Simple ViewModel
For value
<p>
<input type='text' vm-value='demo-value'>
<span vm-html='$root.demo-value'>b</span>
</p>
For Loops
<form vm-form class="form">
<div vm-for='contacts' >
<p>
<span vm-html='$index'>a</span>
<span vm-html='$value.name.first'>b</span>
<span vm-html='$value.name.last'>b</span>
<span vm-html='$value.age'>b</span>
</p>
</div>
<p>
<input type='text' vm-value='demo-value'>
<span vm-html='$root.demo-value'>b</span>
</p>
</form>
window.vm.init();
window.vm.set('demo-value', 'wayne');
window.vm.set('contacts', [{
'name': {
'first': 'cao',
'last': 'zhiqiang'
},
'age': 58
},{
'name': {
'first': 'vi',
'last': 'wayne'
},
'age': 12
},{
'name': {
'first': 'kylar',
'last': 'wayne'
},
'age': 43
}]);
For Show
<button vm-show='showButton'>Continue</button>
<input type='checkbox' vm-checked='showButton'> Show the button!