zoukankan      html  css  js  c++  java
  • 一个页面里如果想获取图片两个地方用到我们怎模板

    我们要给这俩个请求各一个唯一的标识 来判断这个唯一的标识 就相当于index id 或value 等 就可以
    inputchange(event,flag) {
    let imgArr=''
    if(flag===1){
    imgArr=this.addimgarr
    }else{
    imgArr=this.enterpriseImgArr
    }
    //选择input事件
    var self = event.target.files[0];
    this.imgType=self.type.split('/')[1]
    if (typeof FormData !== "function") {
    this.$toast({ text: "浏览器版本过低,请升级浏览器" });
    return false;
    }
    var oMyForm = new FormData();
    oMyForm.append("multipartFile", self);
    this.$post("/jobtbao-platform-srv/platform/srv/fdfs/upload", oMyForm).then(({ object }) => {
    imgArr.push(object.value);
    }).catch(this.errFn);
    },
    delimg(index) {//删除图片事件
    if(index===1){
    this.addimgarr = [];
    }else{
    this.enterpriseImgArr = [];
    }


    },

    }, //这个js代码
    //第一个请求
    <h3>上传营业执照</h3>
    <div class="pageimg" v-if="enterpriseImgArr.length===0" prop="photoUrl">
    <input type="file" @change="inputchange($event,2)" accept="image/*" />
    </div>
    //第二个请求
    <div class="hardere">
    <h3>上传手持身份证照片</h3>
    <div class="pageimg" v-if="addimgarr.length===0">
    <input type="file" @change="inputchange($event,1)" accept="image/*"/>
    </div>

  • 相关阅读:
    使用Dorado框架开发必备参考
    Dorado重用最佳实践
    css布局_web
    dorado学习笔记(二)
    Oracle归档日志删除
    给大家拜年啦!
    悟透JavaScript
    BCM57781网卡驱动下载地址
    win7安装jdk完后配置
    win7删除SVN保存的本地密码
  • 原文地址:https://www.cnblogs.com/congcong1/p/12935217.html
Copyright © 2011-2022 走看看