配合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){}
	});
},
Logo

前往低代码交流专区

更多推荐