zoukankan      html  css  js  c++  java
  • 多文件上传(3)——获取input中的file对象

    具体代码如下:

    <input type="file" id="uploadFile" name="uploadFile" ref="uploadFile" @change="getFile($event)" />

    获取第一个file对象

    getFile(e){
        this.file = e.target.files[0];
    },

     最后上传:


    var
    formData = new FormData(); // 用FormData存放上传文件 formData.append('nowFile',this.file) this.$axios.post('social/insertSocialSecurity',formData)
      .then(res => {   if(res.data.status == 1){   this.$message.success(res.data.message)   }else{   this.$message.error(res.data.message);   }   })   .catch(err => {   console.log(err);   })

  • 相关阅读:
    echarts 饼图
    vue echarts
    :style :class
    弹框弹出时禁止页面滚动
    2019-2-10 日记
    2019-1-27 日记
    2019-1-26 日记
    2019-1-3 日记
    2019-1-10 日记
    2019-1-2 日记
  • 原文地址:https://www.cnblogs.com/dreamstartplace/p/15194570.html
Copyright © 2011-2022 走看看