s2e27 using objects
This commit is contained in:
parent
41c5af3862
commit
f97f01c6da
8
app.js
8
app.js
@ -5,4 +5,12 @@ var app = new Vue({
|
||||
attachGreen: false,
|
||||
attachBlue: true
|
||||
},
|
||||
computed:{
|
||||
divClasses(){
|
||||
return {
|
||||
red: this.attachRed,
|
||||
blue: !this.attachRed
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
10
index.html
10
index.html
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user