When I use code below I'm getting error that istance this.message doesn't exist, but when I will push this as self to MyFunction(self), it will work good. So, the question is how can I push this to my JS file/function without using arguments of function from Vue?
import { MyFunction } from "./Functions/HelpFunctions.js";
data(){
return{
message: 'Hello World'
}
}
methods: {
MyFunction: MyFunction
},
created(){
this.MyFunction();
}
JS file :
export const MyFunction = () => {
console.log(this.message);
}
This cod works if I call it in Vue with pushing this:
export const MyFunction = (self) => {
console.log(self.message);
}