Is it possible to integrate a standard JavaScript class into a Vue.js component without needing anything static? If not, I am open to switching to React or Angular. Are they more suitable than Vue.js for code reusability?
Test.js file:
class Test
{
constructor()
{
this.a = 'test';
}
test()
{
console.log( "test : " + this.a );
}
}
Vue component:
<script>
import Test from './Test.js'
export default {
name:"whatever"
,mounted()
{
var test = new Test();
test.a = "its working";
test.test();
}
}
</script>
Upon executing this in a web browser, the console displays the error message: "TypeError: a() is not a constructor".
Any advice on how to resolve this issue would be greatly appreciated.