s2e27 using objects

This commit is contained in:
Tyrel Souza 2018-04-13 14:57:51 -04:00
parent 41c5af3862
commit f97f01c6da
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 10 additions and 8 deletions

8
app.js
View File

@ -5,4 +5,12 @@ var app = new Vue({
attachGreen: false,
attachBlue: true
},
computed:{
divClasses(){
return {
red: this.attachRed,
blue: !this.attachRed
}
}
}
});

View File

@ -11,14 +11,8 @@
@click="attachRed = !attachRed"
:class="{red: attachRed}"
></div>
<div class="demo"
@click="attachGreen = !attachGreen"
:class="{green: attachGreen}"
></div>
<div class="demo"
@click="attachBlue = !attachBlue"
:class="{blue: attachBlue}"
></div>
<div class="demo" :class="divClasses"></div>
<div class="demo"></div>
</div>
<script src="app.js" charset="utf-8"></script>
</body>