Sparrow README show
by Simon Asika
HTML
<script src="https://rawgit.com/asika32764/sparrow/master/dist/sparrow.js"></script>
<div id="app">
<input id="first" type="text" placeholder="First Name">
<input id="last" type="text" placeholder="Last Name">
<p id="full-name"></p>
</div>
JavaScript
var sp = new Sparrow({
el: '#app',
data: {
firstName: 'john',
lastName: 'williams'
},
configure: function () {
this.$model('#first', 'firstName');
this.$model('#last', 'lastName');
this.$bind('#full-name', 'fullName', ':text');
},
methods: {
capitalize: function (text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
},
computed: {
fullName: function () {
return this.capitalize(this.firstName) + ' ' + this.capitalize(this.lastName);
}
}
});