Uni-app 多图(文件)上传

https://ask.dcloud.net.cn/article/id-35547__page-2

<view ref="inputWrap1" class="input"></view>
<view ref="inputWrap2" class="input"></view>
mounted() {
  var input1 = document.createElement('input')
  input1.type = 'file'
  input1.onchange = (event) => {
    this.File1 = event.target.files[0];
  }
  this.$refs.inputWrap1.$el.appendChild(input1)

  var input2 = document.createElement('input')
  input2.type = 'file'
  input2.onchange = (event) => {
    this.File2 = event.target.files[0];
  }
  this.$refs.inputWrap2.$el.appendChild(input2)
},
let formData = {
  'Field1': this.File1,
}

 2,250 total views,  6 views today

Revisions

Comments are closed.