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:{
}
}
)
本文来自博客园,作者:一石数字欠我15w!!!,转载请注明原文链接:https://www.cnblogs.com/52-qq/p/8386261.html