Skip to content

Commit f01624e

Browse files
committed
Updated global config
1 parent 3b28023 commit f01624e

File tree

1 file changed

+33
-43
lines changed

1 file changed

+33
-43
lines changed

src/api/index.md

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type: api
66

77
`Vue.config` is an object containing Vue's global configurations. You can modify its properties listed below before bootstrapping your application:
88

9-
### debug
9+
### silent
1010

1111
- **Type:** `Boolean`
1212

@@ -15,89 +15,79 @@ type: api
1515
- **Usage:**
1616

1717
``` js
18-
Vue.config.debug = true
18+
Vue.config.silent = true
1919
```
2020

21-
When in debug mode, Vue will:
22-
23-
1. Print stack traces for all warnings.
24-
25-
2. Make all anchor nodes visible in the DOM as Comment nodes. This makes it easier to inspect the structure of the rendered result.
26-
27-
<p class="tip">Debug mode is only available in development build.</p>
21+
Suppress all Vue logs and warnings.
2822

29-
### delimiters
23+
### optionMergeStrategies
3024

31-
- **Type:** `Array<String>`
25+
- **Type:** `Object`
3226

33-
- **Default:** `{% raw %}["{{", "}}"]{% endraw %}`
27+
- **Default:** `{}`
3428

3529
- **Usage:**
3630

3731
``` js
38-
// ES6 template string style
39-
Vue.config.delimiters = ['${', '}']
40-
```
41-
42-
Change the plain text interpolation delimiters.
43-
44-
### unsafeDelimiters
45-
46-
- **Type:** `Array<String>`
47-
48-
- **Default:** `{% raw %}["{{{", "}}}"]{% endraw %}`
32+
Vue.config.optionMergeStrategies._my_option = function (parent, child, vm) {
33+
return child + 1
34+
}
4935

50-
- **Usage:**
36+
const Profile = Vue.extend({
37+
_my_option: 1
38+
})
5139

52-
``` js
53-
// make it look more dangerous
54-
Vue.config.unsafeDelimiters = ['{!!', '!!}']
40+
// Profile.options._my_option = 2
5541
```
5642

57-
Change the raw HTML interpolation delimiters.
43+
Define custom merging strategies for options.
5844

59-
### silent
45+
The merge strategy receives the value of that option defined on the parent and child instances as the first and second arguments, respectively. The context Vue instance is passed as the third argument.
46+
47+
### devtools
6048

6149
- **Type:** `Boolean`
6250

63-
- **Default:** `false`
51+
- **Default:** `true` (`false` in production builds)
6452

6553
- **Usage:**
6654

6755
``` js
68-
Vue.config.silent = true
56+
// make sure to set this synchronously immediately after loading Vue
57+
Vue.config.devtools = true
6958
```
7059

71-
Suppress all Vue.js logs and warnings.
60+
Configure whether to allow [vue-devtools](https://github.com/vuejs/vue-devtools) inspection. This option's default value is `true` in development builds and `false` in production builds. You can set it to `true` to enable inspection for production builds.
7261

73-
### async
62+
### errorHandler
7463

75-
- **Type:** `Boolean`
64+
- **Type:** `Function`
7665

77-
- **Default:** `true`
66+
- **Default:** Error is thrown in place
7867

7968
- **Usage:**
8069

8170
``` js
82-
Vue.config.async = false
71+
Vue.config.errorHandler = function (err, vm) {
72+
// handle error
73+
}
8374
```
8475

85-
When async mode is off, Vue will perform all DOM updates synchronously upon detecting data change. This may help with debugging in some scenarios, but could also cause degraded performance and affect the order in which watcher callbacks are called. **`async: false` is not recommended in production.**
76+
Assign a handler for uncaught errors during component render and watchers. The handler gets called with the error and the Vue instance.
8677

87-
### devtools
78+
### keyCodes
8879

89-
- **Type:** `Boolean`
80+
- **Type:** `Object`
9081

91-
- **Default:** `true` (`false` in production builds)
82+
- **Default:** `{}`
9283

9384
- **Usage:**
9485

9586
``` js
96-
// make sure to set this synchronously immediately after loading Vue
97-
Vue.config.devtools = true
87+
Vue.config.keyCodes = { esc: 27 }
9888
```
9989

100-
Configure whether to allow [vue-devtools](https://github.com/vuejs/vue-devtools) inspection. This option's default value is `true` in development builds and `false` in production builds. You can set it to `true` to enable inspection for production builds.
90+
Define custom key aliases for v-on.
10191

10292
## Global API
10393

0 commit comments

Comments
 (0)