Created
February 9, 2019 12:14
-
-
Save revdfdev/cc2a6bbf3d60d627f33e14e87d132f78 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/yekogen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.default { | |
background-color: grey; | |
width: 100px; | |
height: 100px; | |
display: inline-block; | |
margin: 10px; | |
} | |
.red { | |
background-color: red | |
} | |
.blue { | |
background-color: blue | |
} | |
.green { | |
background-color: green | |
} | |
</style> | |
</head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script> | |
<div id="app"> | |
<div id="demo1" class="default" :style="{backgroundColor: color}"></div> | |
<div id="demo2" class="default" :style="myStyle"></div> | |
<div id="demo3" class="default" :style="[myStyle, {height: width + 'px'}]"></div> | |
<hr> | |
<input type="text" v-model="color"> | |
<input type="text" v-model="width"> | |
</div> | |
<script id="jsbin-javascript"> | |
new Vue({ | |
el: "#app", | |
data: { | |
color: "grey", | |
width: 100 | |
}, | |
computed:{ | |
myStyle: function(){ | |
return { | |
backgroundColor: this.color, | |
width: this.width + "px" | |
} | |
}, | |
}, | |
methods: { | |
} | |
}) | |
</script> | |
<script id="jsbin-source-css" type="text/css"> | |
.default { | |
background-color: grey; | |
width: 100px; | |
height: 100px; | |
display: inline-block; | |
margin: 10px; | |
} | |
.red { | |
background-color: red | |
} | |
.blue { | |
background-color: blue | |
} | |
.green { | |
background-color: green | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">new Vue({ | |
el: "#app", | |
data: { | |
color: "grey", | |
width: 100 | |
}, | |
computed:{ | |
myStyle: function(){ | |
return { | |
backgroundColor: this.color, | |
width: this.width + "px" | |
} | |
}, | |
}, | |
methods: { | |
} | |
})</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.default { | |
background-color: grey; | |
width: 100px; | |
height: 100px; | |
display: inline-block; | |
margin: 10px; | |
} | |
.red { | |
background-color: red | |
} | |
.blue { | |
background-color: blue | |
} | |
.green { | |
background-color: green | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Vue({ | |
el: "#app", | |
data: { | |
color: "grey", | |
width: 100 | |
}, | |
computed:{ | |
myStyle: function(){ | |
return { | |
backgroundColor: this.color, | |
width: this.width + "px" | |
} | |
}, | |
}, | |
methods: { | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment