vue获取input file值,并上传
配合jquery的$.ajax<input type="file" class="face" accept="image/*" @change="upload_photo" ref="inputer">upload_photo: function(){var that = this;var inputDOM = that.$refs.inputer;va...
·
配合jquery的$.ajax
<input type="file" class="face" accept="image/*" @change="upload_photo" ref="inputer">
upload_photo: function(){
var that = this;
var inputDOM = that.$refs.inputer;
var file = inputDOM.files;
var formData = new FormData();
formData.append('file', file[0]);
$.ajax({
url: url,
type: "post",
data: formData ,
processData: false,
contentType: false,
success: function(data) {},
error: function(error){}
});
},
更多推荐
已为社区贡献7条内容
所有评论(0)