Skip to content

Commit 32912bb

Browse files
pdanpdanchrisvfritz
authored andcommitted
Document changes in inject definition for feature vuejs/vue#6097 (#1069)
* close #6097: Allow defining optional inject dependency with default values Document changes in inject definition for feature #6097 * reformatted description of inject options * further clarification of inject options description
1 parent afdd344 commit 32912bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/v2/api/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,13 @@ type: api
10081008
10091009
The `provide` option should be an object or a function that returns an object. This object contains the properties that are available for injection into its descendants. You can use ES2015 Symbols as keys in this object, but only in environments that natively support `Symbol` and `Reflect.ownKeys`.
10101010
1011-
The `inject` options should be either an Array of strings or an object where the keys stand for the local binding name, and the value being the key (string or Symbol) to search for in available injections.
1011+
The `inject` option should be either:
1012+
- an array of strings, or
1013+
- an object where the keys are the local binding name and the value is either:
1014+
- the key (string or Symbol) to search for in available injections, or
1015+
- an object where:
1016+
- the `name` property is the key (string or Symbol) to search for in available injections, and
1017+
- the `default` property is used as fallback value
10121018
10131019
> Note: the `provide` and `inject` bindings are NOT reactive. This is intentional. However, if you pass down an observed object, properties on that object do remain reactive.
10141020

0 commit comments

Comments
 (0)