s2e29 no css classes, but still style

This commit is contained in:
Tyrel Souza 2018-04-13 15:10:41 -04:00
parent a42d60c876
commit 73b096560c
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 11 additions and 15 deletions

12
app.js
View File

@ -1,16 +1,14 @@
var app = new Vue({ var app = new Vue({
el: '#app', el: '#app',
data: { data: {
attachRed: false, color: "gray",
attachGreen: false, width: 100
attachBlue: true,
color: "green"
}, },
computed:{ computed:{
divClasses(){ myStyle(){
return { return {
red: this.attachRed, backgroundColor: this.color,
blue: !this.attachRed width: this.width + "px"
} }
} }
} }

View File

@ -7,14 +7,12 @@
</head> </head>
<body> <body>
<div id='app'> <div id='app'>
<div class="demo" <div class="demo" :style="myStyle"></div>
@click="attachRed = !attachRed" <div class="demo"></div>
:class="{red: attachRed}" <div class="demo"></div>
></div>
<div class="demo" :class="divClasses"></div>
<div class="demo" :class="[color, {red: attachRed}]"></div>
<hr> <hr>
<input type="text" v-model="color"> <input type="text" v-model="color">
<input type="text" v-model="width">
</div> </div>
<script src="app.js" charset="utf-8"></script> <script src="app.js" charset="utf-8"></script>
</body> </body>