Skip to content

API Reference

createApp(options)

Creates a new application instance.

Options

  • data: An object containing the initial state of the application.
  • computed: An object of computed properties.
  • methods: An object of methods.
  • watch: An object of watchers.
  • mounted: A function called after the application is mounted.
  • beforeMount: A function called before the application is mounted.
  • beforeUpdate: A function called before the application updates.
  • template: A string or HTMLElement representing the application template.
  • plugins: An array of plugin functions.
  • components: An object of component functions.
  • mixins: An array of mixin objects.
  • directives: An object of custom directives.

app.mount

app.mount(selector) Mounts the application to the DOM element specified by the selector.

app.onUpdated

app.onUpdated(callback) Registers a callback to be called after each update.

app.createPlugin

app.createPlugin(name, handler) Creates a custom plugin.

app.emit

app.emit(eventName, payload) Emits a custom event.

app.on

app.on(eventName, callback) Listens for a custom event.

app.addLifecycleHook

app.addLifecycleHook(hookName, callback) Adds a lifecycle hook.

app.applyMixin

app.applyMixin(mixin) Applies a mixin to the application.

app.component

app.component(name, componentFunction) Registers a new component.

app.render

app.render(templateString) Renders a template string and returns a DocumentFragment.