话不多说,直接上代码
样式:
<style>
.content{
height: 500px;
width: 800px;
overflow: hidden;
text-align: center;
}
.content img{
margin: 0 auto;
}
</style>
内容:
<div id="app">
<div class="content">
<img v-if="!imgShow" src="images/1.png" class="imgOne"/>
<img v-else src="images/2.png" class="imgTwo"/>
</div>
<button @click="changeValue">灯泡开关</button>
</div>
引入vue