使用buefy编程模式,如何在关闭事件中将数据从子组件返回到父组件。我有以下方法可以监听关闭事件,但不知道如何获取数据
settings(question, option, index) {
this.$modal.open({
component: ModalConent,
parent: this,
props: {
"question": question,
"option": option,
"index": index
},
onCancel: function () {
console.log()
},
events: {
}
})
},
答案 0 :(得分:0)
您可以使用events
道具来获取customEvent
:
this.$modal.open({
component: ModalConent,
parent: this,
props: {
"question": question,
"option": option,
"index": index
},
onCancel: function () {
console.log()
},
events: {
'customEvent': value => {
console.log(value)
}
}
})
并在您的子组件中发出customEvent
:
this.$emit('customEvent', value)