1. v-if 每次都要刪除元素或建立元素
2. v-show 每次display:none 或者 block
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div id="app">
<button @click="show = !show ">按鈕</button>
<!-- v-if 每次都要刪除元素或建立元素 -->
<p v-if='show'>show</p>
<!-- 每次display:none 或者 block -->
<p v-show='show'>show</p>
</div>
<script>
var vm=new Vue({
el:'#app',
data:{
show:true
},
methods:{}
});
</script>
</body>
</html>