bind class

This commit is contained in:
Sergio Álvarez 2019-11-09 19:24:21 +01:00
parent e5aa5d8f32
commit 22129d13ab
2 changed files with 5 additions and 1 deletions

View File

@ -14,7 +14,9 @@ var app = new Vue({
{ id: 2, text: 'Learn Vue' },
{ id: 3, text: 'Build something awesome' }
],
label: 'You loaded this page on ' + new Date().toLocaleString()
label: 'You loaded this page on ' + new Date().toLocaleString(),
isActive: true,
hasError: false
},
methods: {
reverseMessage: function () {

View File

@ -28,6 +28,8 @@
<button v-on:click="reverseMessage">Reverse Message</button>
<input v-model="message"> <span>{{ lenMessage }}</span>
<p class="static" v-bind:class="{ active: isActive, 'text-danger': hasError }">class</p>
</div>
<script src="app.js"></script>