1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
    7. <title>Document</title>
    8. <script src="./lib/vue.js"></script>
    9. </head>
    10. <body>
    11. <div id="app">
    12. <input type="button" value="点击" @click="flag=!flag" >
    13. <h3 v-show="flag">这里是H3</h3>
    14. </div>
    15. <script>
    16. var vm = new Vue({
    17. el: '#app',
    18. data: {
    19. flag:false
    20. },
    21. methods: {
    22. }
    23. });
    24. </script>
    25. </body>
    26. </html>

    1.gif