The method app.provide is not documented in the API Reference.
There is a mention of it here but the example is incorrect:
https://github.com/vuejs/docs-next/blame/639940b6154e318b0b26fd4a394defaa82eb45ba/src/guide/migration/global-api.md#L168
The current example given is:
app.provide({
guide: 'Vue 3 Guide'
})
I believe that should be:
app.provide('guide', 'Vue 3 Guide')
A few lines later from: guide also needs changing to from: 'guide'.
There is an important distinction between the provide method, which is part of the Application API, and the provide option for components. While they're both part of the provide/inject mechanism they are distinct ways to provide data.
I've put together an example to demonstrate the difference between the two:
https://jsfiddle.net/skirtle/59h2ya1g/3/
I'm not suggesting using that example in the documentation as I suspect it would be confusing. I just wanted to illustrate the difference between the two here. Notice how data provided via the application is injected into the root component, whereas data provided by the root component is only available in its descendants, not in the root component itself.
I reported these problems previously (#345) but I think there may have been a misunderstanding about what changes needed to be made. In summary:
- The
provide method needs to be documented in the Application API section of the API Reference.
- The example in the migration guide needs to be updated.
The method
app.provideis not documented in the API Reference.There is a mention of it here but the example is incorrect:
https://github.com/vuejs/docs-next/blame/639940b6154e318b0b26fd4a394defaa82eb45ba/src/guide/migration/global-api.md#L168
The current example given is:
I believe that should be:
A few lines later
from: guidealso needs changing tofrom: 'guide'.There is an important distinction between the
providemethod, which is part of the Application API, and theprovideoption for components. While they're both part of theprovide/injectmechanism they are distinct ways to provide data.I've put together an example to demonstrate the difference between the two:
https://jsfiddle.net/skirtle/59h2ya1g/3/
I'm not suggesting using that example in the documentation as I suspect it would be confusing. I just wanted to illustrate the difference between the two here. Notice how data provided via the application is injected into the root component, whereas data provided by the root component is only available in its descendants, not in the root component itself.
I reported these problems previously (#345) but I think there may have been a misunderstanding about what changes needed to be made. In summary:
providemethod needs to be documented in the Application API section of the API Reference.