我是vuejs的新手,所以无法找出我做错了什么。这是我的vue组件的脚本部分:
<script>
export default {
name: 'product-main-info',
components: {
vueDropzone: vue2Dropzone
},
props: {
propId: String,
},
data() {
return {
images: {},
dropzoneOptions: {
url: '/uploadImg',
thumbnailWidth: 150,
maxFilesize: 2.0,
addRemoveLinks: true,
acceptedFiles: ".png,.jpg,.gif,.bmp,.jpeg",
headers: { "X-CSRF-Token": document.head.querySelector('meta[name="csrf-token"]').content },
params: { id: this.propId },
init: function() {
var self = this;
self.on("success", function (file) {
this.$http.get('/getProductImages/' + this.propId)
.then(function(response) {
this.images = response.data;
});
});
}
}
}
},
methods: {
},
created() {
this.$http.get('/getProductImages/' + this.propId)
.then(function(response) {
console.log(response.data);
this.images = response.data;
});
}
}
</script>
我正在尝试在成功上传图像后获取新的刷新数据,但我得到的只有:
app.js:16014 Uncaught TypeError: Cannot read property 'get' of undefined
我所需要的只是刷新我的数据,但我无法找到如何以正确的方式做到这一点。尽可能帮助