You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/api/index.md
+121Lines changed: 121 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -695,6 +695,127 @@ Called after the template has just been compiled, before `vm.$el` is created.
695
695
-**See also:**
696
696
-[Transitions](/guide/transitions.html)
697
697
698
+
## Options / Misc
699
+
700
+
### parent
701
+
702
+
-**Type:**`Vue instance`
703
+
704
+
-**Details:**
705
+
706
+
Specify the parent instance for the instance to be created. Establishes a parent-child relationship between the two. The parent will be accessible as `this.$parent` for the child, and the child will be pushed into the parent's `$children` array.
The `mixins` option accepts an array of mixin objects. These mixin objects can contain instance options just like normal instance objects, and they will be merged against the eventual options using the same option merging logic in `Vue.extend()`. e.g. If your mixin contains a created hook and the component itself also has one, both functions will be called.
717
+
718
+
Mixin hooks are called in the order they are provided, and called before the component's own hooks.
719
+
720
+
-**Example:**
721
+
722
+
```js
723
+
var mixin = {
724
+
created:function () { console.log(1) }
725
+
}
726
+
var vm =newVue({
727
+
created:function () { console.log(2) },
728
+
mixins: [mixin]
729
+
})
730
+
// -> 1
731
+
// -> 2
732
+
```
733
+
734
+
-**See also:**[Mixins](/guide/mixins.html)
735
+
736
+
### name
737
+
738
+
-**Type:**`String`
739
+
740
+
-**Restriction:** only respected when used in `Vue.extend()`.
741
+
742
+
-**Details:**
743
+
744
+
Allow the component to recursively invoke itself in its template. Note that when a component is registered globally with `Vue.component()`, the global ID is automatically set as its name.
745
+
746
+
Another benefit of specifying a `name` option is console inspection. When inspecting an extended Vue component in the console, the default constructor name is `VueComponent`, which isn't very informative. By passing in an optional `name` option to `Vue.extend()`, you will get a better inspection output so that you know which component you are looking at. The string will be camelized and used as the component's constructor name.
747
+
748
+
-**Example:**
749
+
750
+
```js
751
+
var Ctor =Vue.extend({
752
+
name:'stack-overflow',
753
+
template:
754
+
'<div>'+
755
+
// recursively invoke self
756
+
'<stack-overflow></stack-overflow>'+
757
+
'</div>'
758
+
})
759
+
760
+
// this will actually result in a max stack size exceeded
Allows declaratively extending another component (could be either a plain options object or a constructor) without having to use `Vue.extend`. This is primarily intended to make it easier to extend between single file components.
774
+
775
+
This is similar to `mixins`, the difference being that the component's own options takes higher priority than the source component being extended.
776
+
777
+
-**Example:**
778
+
779
+
```js
780
+
var CompA = { ... }
781
+
782
+
// extend CompA without having to call Vue.extend on either
783
+
var CompB = {
784
+
extends: CompA,
785
+
...
786
+
}
787
+
```
788
+
789
+
### delimiters
790
+
791
+
-**Type:**`Array<String>`
792
+
793
+
-**default:**`["{{", "}}"]`
794
+
795
+
-**Details:**
796
+
797
+
Change the plain text interpolation delimiters. This option is only available in the standalone build.
798
+
799
+
-**Example:**
800
+
801
+
```js
802
+
newVue({
803
+
delimiters: ['${', '}']
804
+
})
805
+
806
+
// Delimiters changed to ES6 template string style
807
+
```
808
+
809
+
### functional
810
+
811
+
-**Type:**`boolean`
812
+
813
+
-**Details:**
814
+
815
+
Causes a component to be stateless (no `data`) and instanceless (no `this` context). They are simply a `render` function that returns virtual nodes making them much cheaper to render.
0 commit comments