49 lines
957 B
HTML
49 lines
957 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>
|
|
<style>
|
|
*{
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
#app{
|
|
width: 80px;
|
|
height: 50px;
|
|
border: 1px solid #f00;
|
|
padding: 100px;
|
|
font-size: 20px;
|
|
font-weight: bolder;
|
|
margin: 20px auto;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app" :style="BcChange()">
|
|
{{data}}
|
|
<button @click="Clickme()">点击我</button>
|
|
</div>
|
|
|
|
</body>
|
|
<script src="../JavaScript/vue.min.js"></script>
|
|
<script>
|
|
let vue=new Vue({
|
|
el:"#app",
|
|
data:{
|
|
data:"你好呀",
|
|
isStyle:`#ff0`
|
|
},
|
|
methods: {
|
|
BcChange:function(){
|
|
return {backgroundColor:this.isStyle}
|
|
},
|
|
Clickme:function(){
|
|
this.isStyle="rgb(23,23,21)"
|
|
}
|
|
},
|
|
})
|
|
</script>
|
|
</html> |