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
// `info` is a Vue-specific error info, e.g. which lifecycle hook
76
+
// the error was found in. Only available in 2.2.0+
75
77
}
76
78
```
77
79
78
80
Définit un gestionnaire pour les erreurs non interceptées pendant le rendu d'un composant et les appels aux observateurs. Ce gestionnaire sera appelé avec comme arguments l'erreur et l'instance de Vue associée.
79
81
82
+
> In 2.2.0, this hook also captures errors in component lifecycle hooks. Also, when this hook is `undefined`, captured errors will be logged with `console.error` instead of crashing the app.
83
+
80
84
> [Sentry](https://sentry.io), un service de traçage d'erreur, fournit une [intégration officielle](https://sentry.io/for/vue/) utilisant cette option.
81
85
82
86
### ignoredElements
@@ -114,6 +118,30 @@ type: api
114
118
115
119
Définit des alias pour les touches du clavier avec `v-on`.
116
120
121
+
### performance
122
+
123
+
> New in 2.2.0
124
+
125
+
-**Type:**`boolean`
126
+
127
+
-**Default:**`false`
128
+
129
+
-**Usage**:
130
+
131
+
Set this to `true` to enable component init, compile, render and patch performance tracing in the browser devtool timeline. Only works in development mode and in browsers that support the [performance.mark](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) API.
132
+
133
+
### productionTip
134
+
135
+
> New in 2.2.0
136
+
137
+
-**Type:**`boolean`
138
+
139
+
-**Default:**`true`
140
+
141
+
-**Usage**:
142
+
143
+
Set this to `false` to prevent the production tip on Vue startup.
144
+
117
145
## API globale
118
146
119
147
<h3id="Vue-extend">Vue.extend( options )</h3>
@@ -178,11 +206,11 @@ type: api
178
206
179
207
-**Voir aussi :**[File de mise à jour asynchrone](../guide/reactivity.html#Async-Update-Queue)
180
208
181
-
<h3id="Vue-set">Vue.set( object, key, value )</h3>
209
+
<h3id="Vue-set">Vue.set( target, key, value )</h3>
182
210
183
211
-**Arguments :**
184
-
-`{Object} object`
185
-
-`{string} key`
212
+
-`{Object | Array} target`
213
+
-`{string | number} key`
186
214
-`{any} value`
187
215
188
216
-**Retourne:** la valeur assignée.
@@ -195,17 +223,19 @@ type: api
195
223
196
224
-**Voir aussi :**[Réactivité en détail](../guide/reactivity.html)
197
225
198
-
<h3id="Vue-delete">Vue.delete( object, key )</h3>
226
+
<h3id="Vue-delete">Vue.delete( target, key )</h3>
199
227
200
228
-**Arguments :**
201
-
-`{Object} object`
202
-
-`{string} key`
229
+
-`{Object | Array} target`
230
+
-`{string | number} key`
203
231
204
232
-**Utilisation :**
205
233
206
234
Supprime une propriété d'un objet. Si l'objet est réactif, cette méthode s'assure que la suppression déclenche les mises à jour de la vue. Ceci est principalement utilisé pour passer outre la limitation de Vue qui est de ne pas pouvoir détecter automatiquement la suppression de propriétés, mais vous devriez rarement en avoir besoin.
207
235
208
-
**Notez que l'objet ne peut pas être une instance de Vue, ou l'objet de données à la racine d'une instance de Vue.**
236
+
> Also works with on Array + index in 2.2.0+.
237
+
238
+
<pclass="tip">L'objet cible ne peut pas être une instance de Vue, ou l'objet de données à la racine d'une instance de Vue.</p>
209
239
210
240
-**Voir aussi :**[Réactivité en détail](../guide/reactivity.html)
Provide an alternative render output when the default `render` function encounters an error. The error will be passed to `renderError` as the second argument. This is particularly useful when used together with hot-reload.
All lifecycle hooks automatically have their `this` context bound to the instance, so that you can access data, computed properties, and methods. This means __you should not use an arrow function to define a lifecycle method__ (e.g. `created: () => this.fetchTodos()`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.fetchTodos` will be undefined.
@@ -750,7 +808,6 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
@@ -774,7 +831,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
774
831
- **Voir aussi :**
775
832
- [Components](../guide/components.html)
776
833
777
-
## Options / Misc
834
+
## Options / Composition
778
835
779
836
### parent
780
837
@@ -812,18 +869,6 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
812
869
813
870
- **Voir aussi :** [Mixins](../guide/mixins.html)
814
871
815
-
### name
816
-
817
-
-**Type :**`string`
818
-
819
-
-**Restriction :** only respected when used as a component option.
820
-
821
-
-**Détails :**
822
-
823
-
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.
824
-
825
-
Another benefit of specifying a `name` option is debugging. Named components result in more helpful warning messages. Also, when inspecting an app in the [vue-devtools](https://github.com/vuejs/vue-devtools), unnamed components will show up as `<AnonymousComponent>`, which isn't very informative. By providing the `name` option, you will get a much more informative component tree.
826
-
827
872
### extends
828
873
829
874
- **Type :** `Object|Function`
@@ -846,6 +891,77 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
<p class="tip">`provide` and `inject` are primarily provided for advanced plugin / component library use cases. It is NOT recommended to use them in generic application code.</p>
905
+
906
+
This pair of options are used together to allow an ancestor component to serve as a dependency injector for its all descendants, regardless of how deep the component hierarchy is, as long as they are in the same parent chain. If you are familiar with React, this is very similar to React's context feature.
907
+
908
+
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`.
909
+
910
+
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.
911
+
912
+
> 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.
913
+
914
+
- **Example:**
915
+
916
+
``` js
917
+
var Provider = {
918
+
provide: {
919
+
foo:'bar'
920
+
},
921
+
// ...
922
+
}
923
+
924
+
var Child = {
925
+
inject: ['foo'],
926
+
created () {
927
+
console.log(this.foo) // -> "bar"
928
+
}
929
+
// ...
930
+
}
931
+
```
932
+
933
+
With ES2015 Symbols, function `provide` and object `inject`:
934
+
``` js
935
+
consts=Symbol()
936
+
937
+
constProvider= {
938
+
provide () {
939
+
return {
940
+
[s]:'foo'
941
+
}
942
+
}
943
+
}
944
+
945
+
constChild= {
946
+
inject: { s },
947
+
// ...
948
+
}
949
+
```
950
+
951
+
## Options / Misc
952
+
953
+
### name
954
+
955
+
- **Type:** `string`
956
+
957
+
- **Restriction:** only respected when used as a component option.
958
+
959
+
- **Details:**
960
+
961
+
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.
962
+
963
+
Another benefit of specifying a `name` option is debugging. Named components result in more helpful warning messages. Also, when inspecting an app in the [vue-devtools](https://github.com/vuejs/vue-devtools), unnamed components will show up as `<AnonymousComponent>`, which isn't very informative. By providing the `name` option, you will get a much more informative component tree.
964
+
849
965
### delimiters
850
966
851
967
- **Type :** `Array<string>`
@@ -876,6 +992,46 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
876
992
877
993
- **Voir aussi :** [Functional Components](../guide/render-function.html#Functional-Components)
878
994
995
+
### model
996
+
997
+
> New in 2.2.0
998
+
999
+
- **Type:** `{ prop?: string, event?: string }`
1000
+
1001
+
- **Details:**
1002
+
1003
+
Allows a custom component to customize the prop and event used when it's used with `v-model`. By default, `v-model` on a component uses `value` as the prop and `input` as the event, but some input types such as checkboxes and radio buttons may want to use the `value` prop for a different purpose. Using the `model` option can avoid the conflict in such cases.
1004
+
1005
+
- **Example:**
1006
+
1007
+
``` js
1008
+
Vue.component('my-checkbox', {
1009
+
model: {
1010
+
prop:'checked',
1011
+
event:'change'
1012
+
},
1013
+
props: {
1014
+
// this allows using the `value` prop for a different purpose
0 commit comments