<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>vue数据绑定</title>
<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="test">
<p v-if="isShow">我是白云</p>
<p v-else>我是黑土</p>
<button @click="checkout">交换</button>
</div>
<script type="text/javascript">
var myVue = new Vue({
el: ".test",
data: {
isShow: true
},
methods: {
checkout:function() {
if(this.isShow==true) {
this.isShow=false;
}else {
this.isShow=true
}
}
}
})
</script>
</body>
</html>