Skip to content

Commit 2fa36c0

Browse files
committed
document $addChild
1 parent 896db4a commit 2fa36c0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

source/api/instance-methods.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,17 @@ Completely destroy a vm. Clean up its connections with other existing vms, unbin
199199

200200
- **element** `HTMLElement`
201201

202-
Partially compile a piece of DOM (Element or DocumentFragment). The method returns a `decompile` function that tearsdown the directives created during the process. Note the decompile function does not remove the DOM. This method is exposed primarily for writing advanced custom directives.
202+
Partially compile a piece of DOM (Element or DocumentFragment). The method returns a `decompile` function that tearsdown the directives created during the process. Note the decompile function does not remove the DOM. This method is exposed primarily for writing advanced custom directives.
203+
204+
### vm.$addChild( [options, constructor] )
205+
206+
- **options** `Object` *optional*
207+
- **constructor** `Function` *optional*
208+
209+
Adds a child instance to the current instance. The options object is the same in manually instantiating an instance. Optionally you can pass in a constructor created from `Vue.extend()`.
210+
211+
There are three implications of a parent-child relationship between instances:
212+
213+
1. The parent and child can communicate via [the event system](#Events).
214+
2. The child has access to all parent assets (e.g. custom directives).
215+
3. The child, if inheriting parent scope, has access to parent scope data properties.

0 commit comments

Comments
 (0)