1. 程式人生 > >動畫-點擊顯示與隱藏

動畫-點擊顯示與隱藏

put ont val body cli method -c 顯示與隱藏 http

<!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>Title</title> <script src="js/vue-2.4.0.js"></script> </head> <body> <div id="app"> <!--需求:點擊按鈕,讓h3顯示,再點擊,讓h3隱藏--> <input type="button" value="toggle" @click="flag=!flag"> <h3 v-if="flag">這是一個h3</h3> </div> <script> const vm=new Vue({ el:‘#app‘, data:{ flag:false }, methods:{} }) </script> </body> </html>

動畫-點擊顯示與隱藏