vue.js框架自学笔记(1)---小的调查问卷

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>hello world</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
<div id="app">
    <!--text-->
    <input type="text" v-model="message">
    <br>
    <br>
    <!--radio-->
    <label><input type="radio" value="male" v-model="gender">男</label>
    <label><input type="radio" value="female" v-model="gender">女</label>
    <br>
    <br>
    <!--checkbox-->
    <label><input type="checkbox"  v-model="checked">已婚</label>
    <br>
    <!--多个勾选框-->
    <br>
    <label>属于第几类人员<input type="checkbox" value="1" v-model="multiChecked">1</label>
    <label><input type="checkbox" value="2" v-model="multiChecked">2</label>
    <label><input type="checkbox" value="3" v-model="multiChecked">3</label>
    <br>
    <!--select-->
    <br>
    <select v-model="selected">
        <option selected>A</option>
        <option>B</option>
        <option>C</option>
    </select>
    <br>
    <br>
    <select v-model="multiSelected" multiple>
        <option selected>A</option>
        <option>B</option>
        <option>C</option>
    </select>
    <br>
    <br>
    <p>-------------------<p>
    <span>姓名:{{message}}</span>
    <p>{{gender}}</p>
    <span>已婚:{{checked}}</span>
    <p>第[ {{multiChecked.join('')}} ]类人员</p>
    <span>选择你的目标成绩: {{selected}}</span>
    <br>
    <br>
    <span>实际成绩:{{multiSelected.join('|')}}</span>
</div>
    
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            message:'',
            gender:'',
            checked:'',
            multiChecked:[],
            selected:'',
            multiSelected:[],
            a:'checked',
            b:'checked',
        }
    });
</script>
</body>

 

 

参考 https://blog.csdn.net/moses_binson/article/details/88688621 的文章

 

上一篇:用Javascript实现复选框全选/反选功能


下一篇:jq查找和拼接checkbox的值