Skip to content

Commit 8162eb5

Browse files
committed
Merge pull request #1 from kunth/kunth-patch-1
Update global-api.md
2 parents b1c02aa + 4796217 commit 8162eb5

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

source/api/global-api.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,80 @@ order: 5
66
### Vue.config
77

88
`Vue.config` is an object containing Vue's global settings. Here are the list of all the avaiable settings with their default values:
9+
`Vue.config` 是包含 Vue 全局设置的对象。下面列出了所有可设置变量及其默认值:
910

1011
``` js
1112
{
1213
// print stack trace for warnings?
14+
// 打印 warnings 的堆栈跟踪?
1315
debug: true,
1416
// attribute prefix for directives
17+
// 指令的属性前缀
1518
prefix: 'v-',
1619
// interpolation delimiters
20+
// 插入分隔符
1721
// for HTML interpolations, add
1822
// 1 extra outer-most character.
23+
// 对于插入HTML,添加一个额外的最外层字符
1924
delimiters: ['{{', '}}'],
2025
// suppress warnings?
26+
// 抑制 warnings?
2127
silent: false,
2228
// interpolate mustache bindings?
29+
// 插入 mustache 绑定?
2330
interpolate: true,
2431
// use async updates (for directives & watchers)?
32+
// (对 directives 和 watchers)使用异步更新?
2533
async: true,
2634
// allow altering observed Array's prototype chain?
35+
// 允许改变所观察的Array的原型链?
2736
proto: true
2837
}
2938
```
3039

3140
You can modify them directly, for example:
41+
你可以直接对其修改,例如:
3242

3343
``` js
3444
Vue.config.debug = true // turn on debugging mode
45+
Vue.config.debug = true // 开启调试模式
3546
```
3647

3748
**Debug Mode**
49+
**调试模式**
3850

3951
When `Vue.config.debug` is set to true, Vue will automatically use synchronous mode and throw a `debugger` statement when there is a warning. This enables the user to inspect the full stack trace in browser dev tools.
52+
`Vue.config.debug` 设置为 true 时,Vue 会自动启动同步模式,并在有警告时抛出一个 `debugger ` 语句。这使得用户能够在浏览器开发工具中检查完整的堆栈跟踪(full stack trace)
4053

4154
<p class="tip">debug mode is not available in the minified production builds.</p>
55+
<p class="tip">调试模式在压缩的生产环境(minified production builds)下是不可用的</p>
4256

4357
**Changing Delimiters**
58+
**改变分隔符(Delimiters)**
4459

4560
When the delimiters are set for text interpolation, the delimiters for HTML interpolation will be generated by adding one outer-most symbol on both sides:
61+
当分隔符(delimiters)是设置为插入文本时,那么设置为插入HTML的分隔符可以通过在两边的最外层加上符号来生成。
4662

4763
``` js
4864
Vue.config.delimiters = ['(%', '%)']
4965
// tags now are (% %) for text
66+
// (% %)是文本的标签
5067
// and ((% %)) for HTML
68+
// 则((% %))是HTML的标签
5169
```
5270

5371
### Vue.extend( options )
5472

5573
- **options** `Object`
5674

5775
Create a "subclass" of the base Vue constructor. All [instantiation options](../api/options.html) can be used here. The special cases to note here are `el` and `data`, which must be functions in this case.
76+
创建一个基类 Vue 构造函数的"子类"。所有的[实例化选项](../api/options.html)都可以在此用到。其中需要特殊提及的是 `el``data`,在这个类里他们必须作为函数使用。
5877

5978
Internally, `Vue.extend()` is called on all component options before instantiating the components. For more details regarding components, see [Component System](../guide/components.html).
79+
在所有组件(components)被初始化之前,`Vue.extend()`被组件选项隐式地调用。关于组件更多的细节,可详见[组件系统](../guide/components.html)
6080

6181
**Example**
82+
**例子**
6283

6384
``` js
6485
var Profile = Vue.extend({
@@ -75,9 +96,11 @@ var profile = new Profile({
7596
}
7697
})
7798
profile.$appendTo('body')
99+
78100
```
79101

80102
Will result in:
103+
将输出:
81104

82105
``` html
83106
<p>Walter White aka Heisenberg</p>
@@ -87,39 +110,49 @@ Will result in:
87110

88111
- **id** `String`
89112
- **definition** `Function` or `Object` *optional*
113+
- **definition** `Function` or `Object` *可选的*
90114

91115
Register or retrieve a global custom directive. For more details see [Writing Custom Directives](../guide/custom-directive.html).
116+
注册或取得一个全局自定义的指令。详情见[编写自定义指令](../guide/custom-directive.html)
92117

93118
### Vue.filter( id, [definition] )
94119

95120
- **id** `String`
96121
- **definition** `Function` *optional*
122+
- **definition** `Function` *可选的*
97123

98124
Register or retrieve a global custom filter. For more details see [Writing Custom Filters](../guide/custom-filter.html).
125+
注册或取得一个全局自定义的过滤器。详情见[编写自定义过滤器](../guide/custom-filter.html)
99126

100127
### Vue.component( id, [definition] )
101128

102129
- **id** `String`
103130
- **definition** `Function Constructor` or `Object` *optional*
131+
- **definition** `Function Constructor` or `Object` *可选的*
104132

105133
Register or retrieve a global component. For more details see [Component System](../guide/components.html).
134+
注册或取得一个全局自定义的组件。详情见[组件系统](../guide/components.html)
106135

107136
### Vue.transition( id, [definition] )
108137

109138
- **id** `String`
110139
- **definition** `Object` *optional*
140+
- **definition** `Object` *可选的*
111141

112142
Register or retrieve a global JavaScript transition effect definition. For more details see the guide for [JavaScript Transitions](../guide/transitions.html#JavaScript_Functions).
143+
注册或取得一个全局 JavaScript 转换效应(transition effect)定义。详见[JavaScript转换](../guide/transitions.html#JavaScript_Functions)的指导。
113144

114145
### Vue.partial( id, [definition] )
115146

116147
- **id** `String`
117148
- **definition** `String | Node` *optional*
149+
- **definition** `String | Node` *可选的*
118150

119151
Register or retrieve a global partial. The definition can be a template string, a querySelector that starts with `#`, a DOM element (whose innerHTML will be used as the template string), or a DocumentFragment.
152+
注册或取得一个全局的partial。定义可以是一个string模板,一个以`#`开头的querySelector,一个DOM元素(其内嵌HTML作为string模板使用)或者一个DocumentFragment
120153

121154
**Example**
122-
155+
**例子**
123156
HTML
124157

125158
``` html
@@ -142,6 +175,7 @@ new Vue({
142175
```
143176

144177
Will result in:
178+
将输出:
145179

146180
``` html
147181
<div id="demo">
@@ -154,14 +188,18 @@ Will result in:
154188
- **callback** `Function`
155189

156190
Vue.js batches view updates and executes them all asynchronously. It uses `requestAnimationFrame` if available and falls back to `setTimeout(fn, 0)`. This method calls the callback after the next view update, which can be useful when you want to wait until the view has been updated.
191+
Vue.js 批量处理视图更新并对其异步执行。如果可用的话它会使用 `requestAnimationFrame` 并返回到 `setTimeout(fn, 0)`。这个方法在下一个视图更新后调用回调,当你想一直等待到该视图被更新了,用这个方法会很好。
157192

158193
### Vue.use( plugin, [args...] )
159194

160195
- **plugin** `Object` or `Function`
161196
- **args...** *optional*
197+
- **args...** *可选的*
162198

163199
Mount a Vue.js plugin. If the plugin is an Object, it must have an `install` method. If it is a function itself, it will be treated as the install method. The install method will be called with Vue as the argument. For more details, see [Plugins](../guide/extending.html#Extend_with_Plugins).
200+
挂载一个 Vue.js 的插件。如果该插件是一个对象,它必须有一个 `install` 的方法。如果它本身就是一个方法,它必须被作为安装方法来对待。安装方法将会被 Vue 作为一个参数来调用。更多详情请阅[插件](../guide/extending.html#Extend_with_Plugins)
164201

165202
### Vue.util
166203

167-
Exposes the internal `util` module, which contains a number of utility methods. This is intended for advanced plugin/directive authoring, so you will need to look at the source code to see what's available.
204+
Exposes the internal `util` module, which contains a number of utility methods. This is intended for advanced plugin/directive authoring, so you will need to look at the source code to see what's available.
205+
公开内部的 `util` 模块。该模块包含一些列实用方法(utility methods)。这是被为用来编写高级插件/指令,因此你必须查看源码来确定哪些是可操作的。

0 commit comments

Comments
 (0)