v-model在其它元素以及类型上的用法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <label><input v-model="sex" value="male" type="radio">
    </label>
    <label><input v-model="sex" value="female" type="radio">
    </label>
    <hr>{{sex}}
    <hr>
    <label><input v-model="sexs" value="male" type="checkbox">
    </label>
    <label><input v-model="sexs" value="female" type="checkbox">
    </label>
    <hr>{{sexs}}
    <hr>
    <textarea v-model="article"></textarea>
    <hr>{{article}}
    <hr>
    <div>你来自哪里?</div>
    <select v-model="from">
        <option value="1">王家沟</option>
        <option value="2">背背山</option>
    </select>{{from}}
    <div>你要去哪里?</div>
    <select v-model="go" multiple>
        <option value="1">王家沟</option>
        <option value="2">背背山</option>
    </select>{{go}}
</div>

<script src="../lib/vue.js"></script>
<script src="js/main.js"></script>
</body>
</html>
var app = new Vue(
    {
        el:"#app",
        data:{
            sex:"male",
            sexs:["male"],
            article:"我是一个大萝卜,大呀大萝卜",
            from:null,
            go:[]
        },
        methods:{

        }
    }
)

 

posted @ 2018-01-30 17:36  一石数字欠我15w!!!  阅读(1331)  评论(0编辑  收藏  举报