Skip to content

Commit ab61899

Browse files
committed
Merge pull request vuejs#20 from kunth/lang-zh
/api/global-api.md 翻译完成,望指出错误
2 parents 053f1c6 + 5e1bb76 commit ab61899

File tree

1 file changed

+39
-40
lines changed

1 file changed

+39
-40
lines changed

source/api/global-api.md

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,59 @@ order: 5
55

66
### Vue.config
77

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

1010
``` js
1111
{
12-
// print stack trace for warnings?
12+
// 打印 warnings 的堆栈跟踪?
1313
debug: true,
14-
// attribute prefix for directives
14+
// 指令的属性前缀
1515
prefix: 'v-',
16-
// interpolation delimiters
17-
// for HTML interpolations, add
18-
// 1 extra outer-most character.
16+
// 插入分隔符
17+
// 对于插入HTML,添加一个额外的最外层字符
1918
delimiters: ['{{', '}}'],
20-
// suppress warnings?
19+
// 抑制 warnings
2120
silent: false,
22-
// interpolate mustache bindings?
21+
// 插入 mustache 绑定?
2322
interpolate: true,
24-
// use async updates (for directives & watchers)?
23+
// (对 directives watchers)使用异步更新?
2524
async: true,
26-
// allow altering observed Array's prototype chain?
25+
// 允许改变所观察的Array的原型链?
2726
proto: true
2827
}
2928
```
3029

31-
You can modify them directly, for example:
30+
你可以直接对其修改,例如:
3231

3332
``` js
34-
Vue.config.debug = true // turn on debugging mode
33+
Vue.config.debug = true // 开启调试模式
3534
```
3635

37-
**Debug Mode**
36+
**调试模式**
3837

39-
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.
38+
`Vue.config.debug` 设置为 true 时,Vue 会自动启动同步模式,并在有警告时抛出一个 `debugger ` 语句。这使得用户能够在浏览器开发工具中检查完整的堆栈跟踪(full stack trace)
4039

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

43-
**Changing Delimiters**
42+
**改变分隔符(Delimiters)**
4443

45-
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:
44+
当分隔符(delimiters)是设置为插入文本时,那么设置为插入HTML的分隔符可以通过在两边的最外层加上符号来生成。
4645

4746
``` js
4847
Vue.config.delimiters = ['(%', '%)']
49-
// tags now are (% %) for text
50-
// and ((% %)) for HTML
48+
// (% %)是文本的标签
49+
// ((% %))是HTML的标签
5150
```
5251

5352
### Vue.extend( options )
5453

5554
- **options** `Object`
5655

57-
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.
56+
创建一个基类 Vue 构造函数的"子类"。所有的[实例化选项](../api/options.html)都可以在此用到。其中需要特殊提及的是 `el` `data`,在这个类里他们必须作为函数使用。
5857

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

61-
**Example**
60+
**例子**
6261

6362
``` js
6463
var Profile = Vue.extend({
@@ -75,9 +74,10 @@ var profile = new Profile({
7574
}
7675
})
7776
profile.$appendTo('body')
77+
7878
```
7979

80-
Will result in:
80+
将输出:
8181

8282
``` html
8383
<p>Walter White aka Heisenberg</p>
@@ -86,40 +86,39 @@ Will result in:
8686
### Vue.directive( id, [definition] )
8787

8888
- **id** `String`
89-
- **definition** `Function` or `Object` *optional*
89+
- **definition** `Function` or `Object` *可选的*
9090

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

9393
### Vue.filter( id, [definition] )
9494

9595
- **id** `String`
96-
- **definition** `Function` *optional*
96+
- **definition** `Function` *可选的*
9797

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

100100
### Vue.component( id, [definition] )
101101

102102
- **id** `String`
103-
- **definition** `Function Constructor` or `Object` *optional*
103+
- **definition** `Function Constructor` or `Object` *可选的*
104104

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

107107
### Vue.transition( id, [definition] )
108108

109109
- **id** `String`
110-
- **definition** `Object` *optional*
110+
- **definition** `Object` *可选的*
111111

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

114114
### Vue.partial( id, [definition] )
115115

116116
- **id** `String`
117-
- **definition** `String | Node` *optional*
118-
119-
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.
117+
- **definition** `String | Node` *可选的*
120118

121-
**Example**
119+
注册或取得一个全局的partial。定义可以是一个string模板,一个以`#`开头的querySelector,一个DOM元素(其内嵌HTML作为string模板使用)或者一个DocumentFragment
122120

121+
**例子**
123122
HTML
124123

125124
``` html
@@ -141,7 +140,7 @@ new Vue({
141140
})
142141
```
143142

144-
Will result in:
143+
将输出:
145144

146145
``` html
147146
<div id="demo">
@@ -153,15 +152,15 @@ Will result in:
153152

154153
- **callback** `Function`
155154

156-
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.
155+
Vue.js 批量处理视图更新并对其异步执行。如果可用的话它会使用 `requestAnimationFrame` 并返回到 `setTimeout(fn, 0)`。这个方法在下一个视图更新后调用回调,当你想一直等待到该视图被更新了,用这个方法会很好。
157156

158157
### Vue.use( plugin, [args...] )
159158

160159
- **plugin** `Object` or `Function`
161-
- **args...** *optional*
160+
- **args...** *可选的*
162161

163-
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).
162+
挂载一个 Vue.js 的插件。如果该插件是一个对象,它必须有一个 `install` 的方法。如果它本身就是一个方法,它必须被作为安装方法来对待。安装方法将会被 Vue 作为一个参数来调用。更多详情请阅[插件](../guide/extending.html#Extend_with_Plugins)
164163

165164
### Vue.util
166165

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.
166+
公开内部的 `util` 模块。该模块包含一些列实用方法(utility methods)。这是被为用来编写高级插件/指令,因此你必须查看源码来确定哪些是可操作的。

0 commit comments

Comments
 (0)