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