大概看了一下,Vuejs 1.* 可以尝试下面的解决方法:
html:
<input v-el="avatar" type="file" name="avatar" id="avatar" v-on:change="upload">
Vuejs:
methods: {
upload: function(e) {
e.preventDefault();
var files = this.$$.avatar.files;
var data = new FormData();
data.append('avatar', files[0]);
this.$http.post('/avatars/upload', data, function (data, status, request) {
//handling
}).error(function (data, status, request) {
//handling
});
}