image.png

代码

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据绑定之实现双向数据绑定v-model指令(input应用)</title>
    <script src="https://static.gzj2001.com/vue/vue.js"></script>
</head>
<body>
    <div id="app">
        {{info}}
        <!-- 绑定后,info实时刷新 -->
        <input type="text" v-model="info">
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                ok:true,
                info:"allen",
                age:20
            }
        })
    </script>
</body>
</html>