Anonymous

Mod Creation/Essentials: Difference between revisions

From Melvor Idle
Line 377: Line 377:
''This topic is covered in greater detail in [[Mod Creation/Reusable Components with PetiteVue]].''
''This topic is covered in greater detail in [[Mod Creation/Reusable Components with PetiteVue]].''


Melvor Idle ships with [https://github.com/vuejs/petite-vue petite-vue] for mods to use to create reusable HTML components. You can use documentation from the [https://github.com/vuejs/petite-vue official GitHub page] to assist in using the <code>petite-vue</code> library. However, there are some helper functions for making it easier for mods to interact with.
Melvor Idle ships with [https://github.com/vuejs/petite-vue PetiteVue] for mods to use to create reusable HTML components. You can use documentation from the [https://github.com/vuejs/petite-vue official GitHub page] to assist in using the PetiteVue library. However, there are some helper functions for making it easier for mods to interact with.


=== Import HTML Templates ===
=== Import HTML Templates ===
Line 407: Line 407:
=== Defining a Component ===
=== Defining a Component ===


Using the [https://github.com/vuejs/petite-vue#components petite-vue documentation on components], you should define each component as a function. This component should define its template selector using the <code>$template</code> property, and then any additional properties or methods that the rendered component will use. For example:
Using the [https://github.com/vuejs/petite-vue#components PetiteVue documentation on components], you should define each component as a function. This component should define its template selector using the <code>$template</code> property, and then any additional properties or methods that the rendered component will use. For example:


  <nowiki>function Counter(props) {
  <nowiki>function Counter(props) {
91

edits