As a newcomer to VueJs, I find myself unsure about how to pass an optional payload. Can someone guide me on passing the value returned by a computed function from a child component to a parent component using this payload?
I aim to create a standalone search component that can share its results with other components. The computedSports function is as follows:
get computedSports () {
if (!this.searchModel || this.searchModel.length === 0)
return this.sports
else
return this.fuseSearch.search(this.searchModel)
}
This is my attempt at sending the computed function's value to the parent component in the child template:
@input="$bus.$emit('computed-sports', computedSports)"
In the parent component, I am struggling to figure out how to access the child's computed function value:
v-on:computed-sports=""
I would appreciate any assistance on how to do this.
Thanks!