vue233/03-v-bind动态属性绑定/bind样式属性的使用.html

32 lines
643 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<div :style="ChangeStyles()">你好</div>
</div>
</body>
<script src="../00-tools/JavaScript/vue.js"></script>
<script>
let vue=new Vue({
el:"#app",
data:{
isColor:"red",
isSize:"40"
},
methods: {
ChangeStyles:function(){
return {color:this.isColor,fontSize:this.isSize+`px`}
}
},
computed:{
}
})
</script>
</html>