console
new Vue({
el:'#app',
data:{
message:13,
sex:'female',
hobby:['footbal'],
from:1,
math:90,
chinese:90
},
computed:{
sum:function(){
return this.math + this.chinese;
},
avg:function(){
return this.sum / 2;
}
}
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
</head>
<body>
<div id="app">
{{message}}
<input type="radio" v-model="sex" value="female" name="sex"/>男
<input type="radio" v-model="sex" value="male" name="sex"/>女
{{sex}}
<input type="checkbox" name="hobby" v-model="hobby" value="footbal"/>足球
<input type="checkbox" name="hobby" v-model="hobby" value="baskball"/>篮球
<input type="checkbox" name="hobby" v-model="hobby" vallue="pingpang"/>乒乓球
{{hobby}}
<select name="" id="" v-model="from">
<option value="1">山东</option>
<option value="2">上海</option>
</select>
数学: <input type="text" v-model.number="math" />
语文: <input type="text" v-model.number="chinese" />
总分:{{sum}}
平均分:{{avg}}
</div>
</body>
</html>