In this section, we will see how you can conjuge an OOP approach with Vue.js
The first thing you need to do is to export your class declaration. If you have a one class per file project organisation, a Weapon.js
class could look as
Once your class is exported, you can still use it within other classes (or even inherit from them). For example, a NPC.js
class using a weapon:
Then, in a component, you can use this class. Example:
With all that, you have what you need to adopt an OOP approach in your Front End app! Have fun!