buefy Programmatic modal get data in parent from child

Viewed 4187

Using buefy Programmatic modal how can I have the data back from child component to parent on close event. I have the following method I can listen to close event but I do not know how to get the data

settings(question, option, index) {
                this.$modal.open({
                    component: ModalConent,
                    parent: this,
                    props: {
                        "question": question,
                        "option": option,
                        "index": index
                    },
                    onCancel: function () {
                        console.log()
                    },
                    events: {

                    }
                })
            },
1 Answers

You can use events prop to get your 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)
  }

  }
})

and emit customEvent in your child component:

this.$emit('customEvent', value)
Related