我在Vue组件上具有以下内容:
uploaderOptions := make([]func(*s3manager.Uploader), 0)
uploader1 := func (param *s3manager.Uploader) {
fmt.Println("uploader 1", param)
}
uploaderOptions = append(uploaderOptions, uploader1)
uploader2 := func (param *s3manager.Uploader) {
fmt.Println("uploader 2", param)
}
uploaderOptions = append(uploaderOptions, uploader2)
// ...
NewS3FileWriter(ctx, bucket, key, uploaderOptions)
我要实现的是更新引号数组时,它创建了一个自定义事件,因此我可以在父级或其他同级上使用它。
我正在尝试在父组件上使用它,但是返回的是未定义的
父母:
data: function() {
return {
quotes: []
};
},
created() {
eventBus.$on("quoteWasAdded", message => {
this.quotes.push(message);
this.$emit("quotesWereUpdated", this.quotes);
});
}
答案 0 :(得分:0)
我会尝试这样的事情:
<quotes @quotesWereUpdated="updateMessages"></quotes>
然后声明一个方法:
updateMessages (data) {
this.messages = data
}