Can a Vue component's method be triggered by passing the method's name to one of its properties?
// main.vue
<navigation :button-left="goback()"></navigation>
// navigation.component.vue
...
props: ["buttonLeft"],
...
methods: {
goback() {
console.log('Run this.');
},
},
...
I attempted this approach, but encountered 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://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.