onGlobalSetup

You can run functions (or provide data) in the global Nuxt setup() function.

This helper will run a callback function in the global setup function.

~/plugins/myPlugin.js
import { onGlobalSetup, provide } from '@nuxtjs/composition-api'

export default () => {
  onGlobalSetup(() => {
    provide('globalKey', true)
  })
}
This should be called from within a plugin rather than in a component context.
Edit this page on GitHub Updated at Tue, Mar 2, 2021