vue acquired file data

Select the file tag file is read, only with v-on: change monitor value changes.

// 例1:
<input type="file" ref="file" />
<span @click="getFile">提交</span>
getFile(){
  console.log(this.$refs.file.files)     
}


// 例2:
<input type="file" @change="getFile" />
getFile(e){
  console.log(e.target.files)  
}

  

  

  

Guess you like

Origin www.cnblogs.com/sunday123/p/11504885.html