vue-例3-14演示表单输入绑定.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>演示表单输入绑定</title>
</head>
<body>
    <div id="app">
        <h3>多行文本</h3>
        <p style="white-space: pre">{{message}}</p>
        <br>
        <textarea name="text1" id="text1" cols="30" rows="10" v-model="message" placeholder="多行"></textarea><br>
        <input type="checkbox" id="checkbox1" v-model="checked">
        <label for="checkbox1">{{checked}}</label>
        <input type="checkbox" id="jack" value="Jack" v-model="checkedNames">
        <label for="jack">Jack</label>
        <input type="checkbox" id="john" value="John" v-model="checkedNames">
        <label for="john">John</label>
        <input type="checkbox" id="mike" value="Mike" v-model="checkedNames">
        <label for="mike">Mike</label>
        <br>
        <span>Checked names:{{checkedNames}}</span>
        <br>
        <input type="radio" id="one" name="myRadio" value="One" v-model="picked">
        <label for="one">One</label>
        <br>
        <input type="radio" id="two" name="myRadio" value="Two" v-model="picked">
        <label for="two">Two</label>
        <br>
        <span>Picked:{{picked}}</span>
        <hr>
        <select name="select1" id="select1" v-model="mSelected" multiple>
            <option>A</option>
            <option>B</option>
            <option>C</option>
        </select>
        <span>Selected:{{mSelected}}</span>
        <hr>

        <select name="select2" id="select2" v-model="selected">
            <option v-for="op in options" v-bind:value="op.value">
                {{op.text}}
            </option>
        </select>
        <span>Selectd:{{selected}}</span>
    </div>

    <script src="../js/vue.js"></script>

    <script>
        let vm = new Vue({
            el:'#app',
            data:{
                message:'Hello Vue',
                checked:true,
                checkedNames:['Mike','Jack'],
                picked:'One',
                selected:'B',
                mSelected:['A','C'],
                options:[
                    {
                        text:'One',
                        value:'A',
                    },
                    {
                        text:'Two',
                        value:'B',
                    },
                    {
                        text:'Three',
                        value:'C',
                    },
                ]
            }
        });
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虾米大王

有你的支持,我会更有动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值