0Pricing
Vue Academy · Lesson

Plugin Architecture and app.use()

Plugin object { install(app, options) }, accessing app.component, app.directive, app.provide.

What Is a Vue Plugin

A Vue plugin is reusable code that adds app-level functionality — global components, directives, injected services, or config. Examples: Vue Router, Pinia, i18n libraries.

You register a plugin once with app.use(plugin).

The install Contract

A plugin is either an object with an install(app, options) method, or a function used directly as install. Vue calls it with the app instance and any options you pass.

const myPlugin = {
  install(app, options) {
    // register things on the app here
    console.log('installing with', options)
  }
}

export default myPlugin

All lessons in this course

  1. Plugin Architecture and app.use()
  2. Global Properties and provide/inject in Plugins
  3. Notification and Toast Plugin Example
  4. Publishing and Typing Vue Plugins
← Back to Vue Academy