computed example
This commit is contained in:
parent
bfbdea189b
commit
e5aa5d8f32
|
@ -20,5 +20,10 @@ var app = new Vue({
|
|||
reverseMessage: function () {
|
||||
this.message = this.message.split('').reverse().join('')
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
lenMessage: function () {
|
||||
return this.message.length
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<button v-on:click="reverseMessage">Reverse Message</button>
|
||||
|
||||
<input v-model="message">
|
||||
<input v-model="message"> <span>{{ lenMessage }}</span>
|
||||
</div>
|
||||
|
||||
<script src="app.js"></script>
|
||||
|
|
Loading…
Reference in New Issue