vue v-model 数据双向绑定(笔记)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="../JS/vue.js"></script>
<body>
<div id="app">
    <label v-for="item in orhobby">
    <input type="checkbox" :value="item" id="item" v-model="hobbies">{{item}}
    </label>
    <br>
    以下为选中的数据
{{hobbies}}
    <br>
    <input type="text" v-model.lazy="username">
    以下为 type="text"的数据
    {{username}}
</div>
<script>
    const app =new Vue({
        el:"#app", //挂载那个元素
        data:{ messagqe:"胡鸡鸡",
            name:"hujiji",
            orhobby:["揽投","足球","乒乓球","羽毛球"],
            hobbies:[],
            username:''},
        methods:{

        }

    })

</script>
</body>
</html>

 

posted @ 2020-02-05 11:55  乌拉乌拉!!!  阅读(547)  评论(0编辑  收藏  举报