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. <h4>{{msg}}</h4>
    13. <!-- v-bind 简写: 实现M自动绑定到V -->
    14. <input type="text" :value="msg">
    15. <br>
    16. <!-- v-model 实现M到V 也可以实现V到M 所以说v-model是双向绑定-->
    17. <input type="text" v-model="msg">
    18. </div>
    19. <script>
    20. var vm=new Vue({
    21. el:'#app',
    22. data:{
    23. msg:"大家好"
    24. },
    25. methods:{}
    26. });
    27. </script>
    28. </body>
    29. </html>

    1.gif