Vue —— 绑定控件
- 
v-model
为页面输入框进行数据绑定,例如:
- 
input
- 
select
- 
textarea
- 
components
<!-- Author: Asimple -->
<!DOCTYPE html>
<html>
<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>user_input.html</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <!-- v-model: 双向绑定 vue <-> view -->
    <!-- v-bing:  单向绑定 vue  -> view -->
    <div id="example">
        <p>您最喜欢的游戏是:{{game}}</p>
        <!-- v-model 绑定控件内容 -->
        <input type="text" v-model="game">
    </div>
</body>
<script>
    new Vue({
        el: "#example",
        data: {
            game: "超级马里奥"
        }
    });
</script>
</html>

 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号