Reputation: 1870
I have a Vue.js component (named <dynamic-input/>
) which accepts a prop (called input
). I'm trying to pass the returning value of a method (named normalizeInput
) which is defined in the parent component:
<div v-for="input in inputList" :key="input.id">
<dynamic-input :input="normalizeInput(input)" />
</div>
methods: {
normalizeInput(input) {
//do something with input
return normalizedInput;
}
}
Apparently this doesn't work; Is there a way to achieve this? Am I Doing Something Wrong?
I'm Using nuxt v2.15.7
Upvotes: 1
Views: 2739
Reputation: 1
You've to use a computed property that returns a function with the input as parameters :
computed: {
normalizeInput() {
return (input) =>{
return normalizedInput;
}
}
}
Upvotes: 3