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,
|
attachGreen: false,
|
||||||
attachBlue: true
|
attachBlue: true
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
divClasses(){
|
||||||
|
return {
|
||||||
|
red: this.attachRed,
|
||||||
|
blue: !this.attachRed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
10
index.html
10
index.html
|
@ -11,14 +11,8 @@
|
||||||
@click="attachRed = !attachRed"
|
@click="attachRed = !attachRed"
|
||||||
:class="{red: attachRed}"
|
:class="{red: attachRed}"
|
||||||
></div>
|
></div>
|
||||||
<div class="demo"
|
<div class="demo" :class="divClasses"></div>
|
||||||
@click="attachGreen = !attachGreen"
|
<div class="demo"></div>
|
||||||
:class="{green: attachGreen}"
|
|
||||||
></div>
|
|
||||||
<div class="demo"
|
|
||||||
@click="attachBlue = !attachBlue"
|
|
||||||
:class="{blue: attachBlue}"
|
|
||||||
></div>
|
|
||||||
</div>
|
</div>
|
||||||
<script src="app.js" charset="utf-8"></script>
|
<script src="app.js" charset="utf-8"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user