vue-例3-15综合示例演示注册.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>综合示例演示注册</title>
</head>
<body>
    <div id="app">
        <h2 style="text-align: center">填写个人简介</h2>
        <div style="width: 500px;float: left">
            <div style="margin-left: 30px;">
                <form action="">
                    姓名:<input type="text" v-model="user" name="user"><br><br>
                    <fieldset style="margin-right: 30px">
                        <legend>健康信息</legend>
                        身高:<input type="text" v-model="height"><br>
                        体重:<input type="text" v-model="weight">
                    </fieldset>
                    <br>
                    性别:<input type="radio" value="男" v-model="sex">
                    <label for="">男</label>
                    <input type="radio" value="女" v-model="sex">
                    <label for="">女</label>
                    <br>
                    喜爱的运动:<br><br>
                    <input type="checkbox" value="篮球" v-model="checkedNames">
                    <label for="">篮球</label>
                    <input type="checkbox" value="足球" v-model="checkedNames">
                    <label for="">足球</label>
                    <input type="checkbox" value="排球" v-model="checkedNames">
                    <label for="">排球</label>
                    <input type="checkbox" value="游泳" v-model="checkedNames">
                    <label for="">游泳</label>
                    <input type="checkbox" value="跑步" v-model="checkedNames">
                    <label for="">跑步</label>
                    <br>
                    <br>
                    <label for="">地址:</label>
                    <select name="city" id="city" v-model="address">
                        <option value="">请选择城市</option>
                        <option value="北京">北京</option>
                        <option value="上海">上海</option>
                        <option value="南京">南京</option>
                        <option value="广州">广州</option>
                        <option value="深圳">深圳</option>
                        <option value="杭州">杭州</option>
                        <option value="拉萨">拉萨</option>
                    </select>
                    <br><br>
                    个人简介:<br>
                    <textarea name="profile" id="profile" cols="50" rows="10" v-model="profile"></textarea>
                    <br><br>
                    <div style="text-align: center">
                        <input type="submit" value="提交">
                        <input type="reset" value="重置">
                    </div>
                </form>
            </div>
        </div>
        <div style="width: 499px;float:right;">
            <div style="margin-left: 30px">
                姓名:{{user}}<br><br><br>
                身高:{{height}}<br>
                体重:{{weight}}<br>
                性别:{{sex}}<br><br>
                喜爱的运动:{{checkedNames}}<br><br>
                地址:{{address}}<br><br>
                个人简介:{{profile}}<br><br>
            </div>
        </div>
    </div>

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

    <script>
        let vm = new Vue({
           el:'#app',
           data:{
               user:'虾米大王',
               height:178,
               weight:80,
               sex: '男',
               checkedNames: ['跑步','游泳'],
               address: '拉萨',
               profile:'学习vue',
           }
        });

    </script>

    <style>
        #app{
            margin: 0 auto;
            width: 1000px;
            height: 610px;
            border: 1px solid #0f0f0f;
        }

    </style>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
在Vue3中,你可以使用vue-upload-component插件进行多文件上传操作。以下是一个示例代码: ``` <template> <div> <vue-upload-component ref="upload" :multiple="true" :extensions="['jpg', 'jpeg', 'png']" :max-size="5" :url="uploadUrl" @input-filter="inputFilter" @upload-success="uploadSuccess" @upload-error="uploadError" > <button>Upload Files</button> </vue-upload-component> </div> </template> <script> import VueUploadComponent from 'vue-upload-component'; export default { components: { VueUploadComponent, }, data() { return { uploadUrl: 'your-upload-url', }; }, methods: { inputFilter(newFile, oldFile, prevent) { if (newFile && (!oldFile || oldFile.error)) { if (/\.(jpg|jpeg|png)$/.test(newFile.name.toLowerCase())) { newFile.new = true; } else { prevent(); this.$notify({ title: 'Error', message: 'Only upload jpg/jpeg/png files', type: 'error', }); } } }, uploadSuccess(response, file, fileList) { console.log('Upload Success', response, file, fileList); }, uploadError(response, file, fileList) { console.log('Upload Error', response, file, fileList); }, }, }; </script> ``` 在这个示例中,我们首先引入了vue-upload-component插件,然后在模板中使用了这个组件,并设置了相关属性和事件。其中,我们设置了multiple属性为true,这样可以允许用户选择多个文件进行上传;设置了extensions属性为['jpg', 'jpeg', 'png'],这样可以限制只能上传jpg、jpeg和png格式的文件;设置了max-size属性为5,这样可以限制文件大小不超过5MB;设置了url属性为上传接口的地址。在事件中,我们实现了inputFilter、uploadSuccess和uploadError三个方法,用来过滤文件、处理上传成功和上传失败的情况。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

虾米大王

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

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

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

打赏作者

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

抵扣说明:

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

余额充值