Let’s say I have a vue component:
import {foo} from 'path';
export default {
data() {
return {
inputValue: "",
};
},
How can I create imported JavaScript function that takes an inputValue
, modifies it, and then returns the updated state of the inputValue
to the vue component?
I tried passing the inputValue
as a parameter to the function foo()
, changing its value inside the function, and returning it, but I got an undefined
value.
I’m creating an external function because modifying inputValue
is just a small part of the function, and I don’t want my code to become cluttered.