s2e29 no css classes, but still style
This commit is contained in:
parent
a42d60c876
commit
73b096560c
12
app.js
12
app.js
@ -1,16 +1,14 @@
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
attachRed: false,
|
||||
attachGreen: false,
|
||||
attachBlue: true,
|
||||
color: "green"
|
||||
color: "gray",
|
||||
width: 100
|
||||
},
|
||||
computed:{
|
||||
divClasses(){
|
||||
myStyle(){
|
||||
return {
|
||||
red: this.attachRed,
|
||||
blue: !this.attachRed
|
||||
backgroundColor: this.color,
|
||||
width: this.width + "px"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
10
index.html
10
index.html
@ -7,14 +7,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id='app'>
|
||||
<div class="demo"
|
||||
@click="attachRed = !attachRed"
|
||||
:class="{red: attachRed}"
|
||||
></div>
|
||||
<div class="demo" :class="divClasses"></div>
|
||||
<div class="demo" :class="[color, {red: attachRed}]"></div>
|
||||
<div class="demo" :style="myStyle"></div>
|
||||
<div class="demo"></div>
|
||||
<div class="demo"></div>
|
||||
<hr>
|
||||
<input type="text" v-model="color">
|
||||
<input type="text" v-model="width">
|
||||
</div>
|
||||
<script src="app.js" charset="utf-8"></script>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user