v-bink可以动态显示数据
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.one{
color: rebeccapurple;
}
.two{
font-size: 50px;
}
</style>
</head>
<body>
<div id='div'>
<div :class="{ one:isone,two:istwo}">
{{first}}
</div>
<button v-on:click="change">点我一下</button>
<img :src="url" alt="">
</div>
</body>
</html>
<script src="vue.js"></script>
<script>
const div=new Vue({
el:'#div',
data:{
first:"仙女的div",
isone: true,
istwo: true,
url:"img/b87c34f1bca3dbbb531f03c4b6086d3.png"
},
methods:{
change:function(){
this.isone=!this.isone,
this.istwo=!this.istwo
}
}
})
</script>