I'm trying to send a function to a parent component through an event, but when i try to declare the variable that will store the function inside 'data(){return: }' the function gets executed as soon as the variable receives it. I need to find a place to declare the variable without executing the function inside it automatically.
//child
export default: {
data() {
return {
submit_method: { type: Function }
}
},
methods: {
open(type) {
if(type == 'newFolder') {
this.$refs.newFolder.show()
this.submit_method = this.exportFile()
} else {
this.$refs.olderOmbudsman.show()
}
},
exportFile() {
if ( this.doc.origin.id != null ) {
window.open(`${window.globals.API_SERVER}/ombudsman/doc/?page=${this.doc.page}&origin=${this.doc.origin.id}`, '_target')
}else{
alert("Choose the origin!");
}
}
},
activated() {
this.$emit('export-ombudsman', submit_method)
}
}