v-if

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="vue.js"></script>
</head>
<body>
<div id="vue-app07">
<h2>V-if</h2>
<button v-on:click="error=!error">Toggle error</button>
<button v-on:click="success=!success">Toggle success</button>
<p v-if="error">网络连接错误</p>
<p v-else-if="success">网络连接成功</p>
<!-- <p v-show="error">网络连接错误</p>
<p v-else-if="success">网络连接成功</p> -->
</div>
<script src="v-if.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>

 

 

 

 

v-if.js

new Vue({
el:"#vue-app07",
data:{
error:false,
success:false,
},
methods:{

},
computed:{

}
})

posted @ 2020-05-16 09:19  Smile*^  阅读(131)  评论(0编辑  收藏  举报