Suppose I have a function named formatStr in global.js file:
export const formatStr = () => {
return 'something';
}
Now, I am importing it a component say OptionComponent.vue:
import { formatStr } from '@/vue/folder/global';
The component is written in Options API in Vue3. Now when I try to use the function inside template I get this error that it is not a function. But I can use it inside script tag of the component. What is the way to using a function in Options API? Should I declare a local variable or function for that imported function?
I wrote a local function that calls the imported function and then used the local function instead of the imported function.
I expect a clean way to handle function import in Vue Options API.