Skip to content

Commit 5b23ca5

Browse files
committed
更新 API文档翻译
1 parent 6b773ad commit 5b23ca5

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

src/api/index.md

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,15 @@ type: api
305305

306306
- **See also:** [Render Functions](/guide/render-function.html)
307307

308-
## Options / Data
308+
## 选项 / 数据
309309

310310
### data
311311

312-
- **Type:** `Object | Function`
312+
- **类型:** `Object | Function`
313313

314-
- **Restriction:** Only accepts `Function` when used in a component definition.
314+
- **限制:** Only accepts `Function` when used in a component definition.
315315

316-
- **Details:**
316+
- **详细:**
317317

318318
The data object for the Vue instance. Vue will recursively convert its properties into getter/setters to make it "reactive". **The object must be plain**: native objects such as browser API objects and prototype properties are ignored. A rule of thumb is that data should just be data - it is not recommended to observe objects with its own stateful behavior.
319319

@@ -327,7 +327,7 @@ type: api
327327

328328
If required, a deep clone of the original object can be obtained by passing `vm.$data` through `JSON.parse(JSON.stringify(...))`.
329329

330-
- **Example:**
330+
- **示例:**
331331

332332
``` js
333333
var data = { a: 1 }
@@ -349,17 +349,17 @@ type: api
349349

350350
<p class="tip">Note that __you should not use an arrow function with the `data` property__ (e.g. `data: () => { return { a: this.myProp }}`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.myProp` will be undefined.</p>
351351

352-
- **See also:** [Reactivity in Depth](/guide/reactivity.html)
352+
- **另见:** [深入响应式原理h](/guide/reactivity.html)
353353

354354
### props
355355

356-
- **Type:** `Array<string> | Object`
356+
- **类型:** `Array<string> | Object`
357357

358-
- **Details:**
358+
- **详细:**
359359

360360
A list/hash of attributes that are exposed to accept data from the parent component. It has a simple Array-based syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values.
361361

362-
- **Example:**
362+
- **示例:**
363363

364364
``` js
365365
// simple syntax
@@ -385,19 +385,19 @@ type: api
385385
})
386386
```
387387

388-
- **See also:** [Props](/guide/components.html#Props)
388+
- **另见:** [Props](/guide/components.html#Props)
389389

390390
### propsData
391391

392-
- **Type:** `{ [key: string]: any }`
392+
- **类型:** `{ [key: string]: any }`
393393

394-
- **Restriction:** only respected in instance creation via `new`.
394+
- **限制:** only respected in instance creation via `new`.
395395

396-
- **Details:**
396+
- **详细:**
397397

398398
Pass props to an instance during its creation. This is primarily intended to make unit testing easier.
399399

400-
- **Example:**
400+
- **示例:**
401401

402402
``` js
403403
var Comp = Vue.extend({
@@ -414,17 +414,17 @@ type: api
414414

415415
### computed
416416

417-
- **Type:** `{ [key: string]: Function | { get: Function, set: Function } }`
417+
- **类型:** `{ [key: string]: Function | { get: Function, set: Function } }`
418418

419-
- **Details:**
419+
- **详细:**
420420

421421
Computed properties to be mixed into the Vue instance. All getters and setters have their `this` context automatically bound to the Vue instance.
422422

423423
<p class="tip">Note that __you should not use an arrow function to define a computed property__ (e.g. `aDouble: () => this.a * 2`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.a` will be undefined.</p>
424424

425425
Computed properties are cached, and only re-computed on reactive dependency changes.
426426

427-
- **Example:**
427+
- **示例:**
428428

429429
```js
430430
var vm = new Vue({
@@ -451,20 +451,20 @@ type: api
451451
vm.aDouble // -> 4
452452
```
453453

454-
- **See also:**
455-
- [Computed Properties](/guide/computed.html)
454+
- **另见:**
455+
- [计算属性](/guide/computed.html)
456456

457457
### methods
458458

459-
- **Type:** `{ [key: string]: Function }`
459+
- **类型:** `{ [key: string]: Function }`
460460

461-
- **Details:**
461+
- **详细:**
462462

463463
Methods to be mixed into the Vue instance. You can access these methods directly on the VM instance, or use them in directive expressions. All methods will have their `this` context automatically bound to the Vue instance.
464464

465465
<p class="tip">Note that __you should not use an arrow function to define a method__ (e.g. `plus: () => this.a++`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.a` will be undefined.</p>
466466

467-
- **Example:**
467+
- **示例:**
468468

469469
```js
470470
var vm = new Vue({
@@ -479,17 +479,17 @@ type: api
479479
vm.a // 2
480480
```
481481

482-
- **See also:** [Methods and Event Handling](/guide/events.html)
482+
- **另见:** [方法与事件处理器](/guide/events.html)
483483

484484
### watch
485485

486-
- **Type:** `{ [key: string]: string | Function | Object }`
486+
- **类型:** `{ [key: string]: string | Function | Object }`
487487

488-
- **Details:**
488+
- **详细:**
489489

490490
An object where keys are expressions to watch and values are the corresponding callbacks. The value can also be a string of a method name, or an Object that contains additional options. The Vue instance will call `$watch()` for each entry in the object at instantiation.
491491

492-
- **Example:**
492+
- **示例:**
493493

494494
``` js
495495
var vm = new Vue({
@@ -516,7 +516,7 @@ type: api
516516

517517
<p class="tip">Note that __you should not use an arrow function to define a watcher__ (e.g. `searchQuery: newValue => this.updateAutocomplete(newValue)`). The reason is arrow functions bind the parent context, so `this` will not be the Vue instance as you expect and `this.updateAutocomplete` will be undefined.</p>
518518

519-
- **See also:** [Instance Methods - vm.$watch](#vm-watch)
519+
- **另见:** [实例方法 - vm.$watch](#vm-watch)
520520

521521
## Options / DOM
522522

@@ -697,7 +697,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
697697

698698
## 选项 / 资源
699699

700-
### 指令
700+
### directives
701701

702702
- **类型:** `Object`
703703

@@ -709,7 +709,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
709709
- [自定义指令](/guide/custom-directive.html)
710710
- [资源命名约定](/guide/components.html#Assets-Naming-Convention)
711711

712-
### 过滤器
712+
### filters
713713

714714
- **类型:** `Object`
715715

@@ -720,7 +720,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
720720
- **另见:**
721721
- [`Vue.filter`](#Vue-filter)
722722

723-
### 组件
723+
### components
724724

725725
- **类型:** `Object`
726726

@@ -731,29 +731,29 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
731731
- **另见:**
732732
- [组件](/guide/components.html)
733733

734-
## Options / Misc
734+
## 选项 / 杂项
735735

736736
### parent
737737

738-
- **Type:** `Vue instance`
738+
- **类型:** `Vue instance`
739739

740-
- **Details:**
740+
- **详细:**
741741

742742
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.
743743

744744
<p class="tip">Use `$parent` and `$children` sparringly - they mostly serve as an escape-hatch. Prefer using props and events for parent-child communication.</p>
745745

746746
### mixins
747747

748-
- **Type:** `Array<Object>`
748+
- **类型:** `Array<Object>`
749749

750-
- **Details:**
750+
- **详细:**
751751

752752
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.
753753

754754
Mixin hooks are called in the order they are provided, and called before the component's own hooks.
755755

756-
- **Example:**
756+
- **示例:**
757757

758758
``` js
759759
var mixin = {
@@ -767,31 +767,31 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
767767
// -> 2
768768
```
769769

770-
- **See also:** [Mixins](/guide/mixins.html)
770+
- **另见:** [混合](/guide/mixins.html)
771771

772772
### name
773773

774-
- **Type:** `string`
774+
- **类型:** `string`
775775

776-
- **Restriction:** only respected when used as a component option.
776+
- **限制:** only respected when used as a component option.
777777

778-
- **Details:**
778+
- **详细:**
779779

780780
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.
781781

782782
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.
783783

784784
### extends
785785

786-
- **Type:** `Object | Function`
786+
- **类型:** `Object | Function`
787787

788-
- **Details:**
788+
- **详细:**
789789

790790
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.
791791

792792
This is similar to `mixins`, the difference being that the component's own options takes higher priority than the source component being extended.
793793

794-
- **Example:**
794+
- **示例:**
795795

796796
``` js
797797
var CompA = { ... }
@@ -805,15 +805,15 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
805805

806806
### delimiters
807807

808-
- **Type:** `Array<string>`
808+
- **类型:** `Array<string>`
809809

810-
- **default:** `["{{", "}}"]`
810+
- **默认值:** `["{{", "}}"]`
811811

812-
- **Details:**
812+
- **详细:**
813813

814814
Change the plain text interpolation delimiters. **This option is only available in the standalone build.**
815815

816-
- **Example:**
816+
- **示例:**
817817

818818
``` js
819819
new Vue({
@@ -825,13 +825,13 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
825825

826826
### functional
827827

828-
- **Type:** `boolean`
828+
- **类型:** `boolean`
829829

830-
- **Details:**
830+
- **详细:**
831831

832832
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.
833833

834-
- **See also:** [Functional Components](/guide/render-function.html#Functional-Components)
834+
- **另见:** [Functional Components](/guide/render-function.html#Functional-Components)
835835

836836
## Instance Properties
837837

0 commit comments

Comments
 (0)