Is it possible to trigger a Vue components method by handling the methods name to one of it's properties?
// main.vue
<navigation :button-left="goback()"></navigation>
// navigation.component.vue
...
props: ["buttonLeft"],
...
methods: {
goback() {
console.log('Run this.');
},
},
...
I tried it like this but it gives me an error:
[Vue warn]: Property or method "goback" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.