Since my main component of one of my pages is getting a bit large and hard to read I'd like to outsource some of the methods into a frontend controller class.
Here is my test class which is located in a subfolder controller/SporteventsController.js
export class SporteventsController{
test(){
return 'Printing test';
}
}
I'm importing the class into my component as follows:
import {SporteventsController} from "./controller/SporteventsController.js";
for testing I just output the return value of the method test to the console through a method
methods: {
testmethod() {
console.log(SporteventsController.prototype.test());
}
},
I was trying to find a more proper way online on how to import a standart ES6 class into a vuejs component, but without a satisfactory result.
The way I did it above is almost good, but why do I have to use the prototype and can't just use SporteventsController.test()?