computed example

This commit is contained in:
Sergio Álvarez 2019-11-09 12:34:11 +01:00
parent bfbdea189b
commit e5aa5d8f32
2 changed files with 6 additions and 1 deletions

View File

@ -20,5 +20,10 @@ var app = new Vue({
reverseMessage: function () {
this.message = this.message.split('').reverse().join('')
}
},
computed: {
lenMessage: function () {
return this.message.length
}
}
})

View File

@ -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>