Skip to content

Commit 03254a6

Browse files
authored
Translated C1~C4 of style guide (#559)
* Translated C1~C4 of style guide. * typo * typo * typo
1 parent bb030bd commit 03254a6

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

src/v2/style-guide/index.md

+35-36
Original file line numberDiff line numberDiff line change
@@ -1270,111 +1270,111 @@ computed: {
12701270

12711271

12721272

1273-
## Priority C Rules: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
1273+
## 优先级 C 的规则:推荐 (将选择和认知成本最小化)
12741274

12751275

12761276

1277-
### Component/instance options order <sup data-p="c">recommended</sup>
1277+
### 组件/实例的选项的顺序 <sup data-p="c">推荐</sup>
12781278

1279-
**Component/instance options should be ordered consistently.**
1279+
**组件/实例的选项应该有统一的顺序。**
12801280

1281-
This is the default order we recommend for component options. They're split into categories, so you'll know where to add new properties from plugins.
1281+
这是我们推荐的组件选项默认顺序。它们被划分为几大类,所以你也能知道从插件里添加的新属性应该放到哪里。
12821282

1283-
1. **Side Effects** (triggers effects outside the component)
1283+
1. **副作用** (触发组件外的影响)
12841284
- `el`
12851285

1286-
2. **Global Awareness** (requires knowledge beyond the component)
1286+
2. **全局感知** (要求组件以外的知识)
12871287
- `name`
12881288
- `parent`
12891289

1290-
3. **Component Type** (changes the type of the component)
1290+
3. **组件类型** (更改组件的类型)
12911291
- `functional`
12921292

1293-
4. **Template Modifiers** (changes the way templates are compiled)
1293+
4. **模板修改器** (改变模板的编译方式)
12941294
- `delimiters`
12951295
- `comments`
12961296

1297-
5. **Template Dependencies** (assets used in the template)
1297+
5. **模板依赖** (模板内使用的资源)
12981298
- `components`
12991299
- `directives`
13001300
- `filters`
13011301

1302-
6. **Composition** (merges properties into the options)
1302+
6. **组合** (向选项里合并属性)
13031303
- `extends`
13041304
- `mixins`
13051305

1306-
7. **Interface** (the interface to the component)
1306+
7. **接口** (组件的接口)
13071307
- `inheritAttrs`
13081308
- `model`
13091309
- `props`/`propsData`
13101310

1311-
8. **Local State** (local reactive properties)
1311+
8. **本地状态** (本地的响应式属性)
13121312
- `data`
13131313
- `computed`
13141314

1315-
9. **Events** (callbacks triggered by reactive events)
1315+
9. **事件** (通过响应式事件触发的回调)
13161316
- `watch`
1317-
- Lifecycle Events (in the order they are called)
1317+
- 生命周期钩子 (按照它们被调用的顺序)
13181318

1319-
10. **Non-Reactive Properties** (instance properties independent of the reactivity system)
1319+
10. **非响应式的属性** (不依赖响应系统的实例属性)
13201320
- `methods`
13211321

1322-
11. **Rendering** (the declarative description of the component output)
1322+
11. **渲染** (组件输出的声明式描述)
13231323
- `template`/`render`
13241324
- `renderError`
13251325

13261326

13271327

1328-
### Element attribute order <sup data-p="c">recommended</sup>
1328+
### 元素特性的顺序 <sup data-p="c">推荐</sup>
13291329

1330-
**The attributes of elements (including components) should be ordered consistently.**
1330+
**元素 (包括组件) 的特性应该有统一的顺序。**
13311331

1332-
This is the default order we recommend for component options. They're split into categories, so you'll know where to add custom attributes and directives.
1332+
这是我们为组件选项推荐的默认顺序。它们被划分为几大类,所以你也能知道新添加的自定义特性和指令应该放到哪里。
13331333

1334-
1. **Definition** (provides the component options)
1334+
1. **定义** (提供组件的选项)
13351335
- `is`
13361336

1337-
2. **List Rendering** (creates multiple variations of the same element)
1337+
2. **列表渲染** (创建多个变化的相同元素)
13381338
- `v-for`
13391339

1340-
2. **Conditionals** (whether the element is rendered/shown)
1340+
2. **条件渲染** (元素是否渲染/显示)
13411341
- `v-if`
13421342
- `v-else-if`
13431343
- `v-else`
13441344
- `v-show`
13451345
- `v-cloak`
13461346

1347-
3. **Render Modifiers** (changes the way the element renders)
1347+
3. **渲染方式** (改变元素的渲染方式)
13481348
- `v-pre`
13491349
- `v-once`
13501350

1351-
4. **Global Awareness** (requires knowledge beyond the component)
1351+
4. **全局感知** (需要超越组件的知识)
13521352
- `id`
13531353

1354-
5. **Unique Attributes** (attributes that require unique values)
1354+
5. **唯一的特性** (需要唯一值的特性)
13551355
- `ref`
13561356
- `key`
13571357
- `slot`
13581358

1359-
6. **Two-Way Binding** (combining binding and events)
1359+
6. **双向绑定** (把绑定和事件结合起来)
13601360
- `v-model`
13611361

1362-
7. **Other Attributes** (all unspecified bound & unbound attributes)
1362+
7. **其它特性** (所有普通的绑定或未绑定的特性)
13631363

1364-
8. **Events** (component event listeners)
1364+
8. **事件** (组件事件监听器)
13651365
- `v-on`
13661366

1367-
9. **Content** (overrides the content of the element)
1367+
9. **内容** (复写元素的内容)
13681368
- `v-html`
13691369
- `v-text`
13701370

13711371

13721372

1373-
### Empty lines in component/instance options <sup data-p="c">recommended</sup>
1373+
### 组件/实例选项中的空行 <sup data-p="c">推荐</sup>
13741374

1375-
**You may want to add one empty line between multi-line properties, particularly if the options can no longer fit on your screen without scrolling.**
1375+
**你可能想在多个属性之间增加一个空行,特别是在这些选项一屏放不下,需要滚动才能都看到的时候。**
13761376

1377-
When components begin to feel cramped or difficult to read, adding spaces between multi-line properties can make them easier to skim again. In some editors, such as Vim, formatting options like this can also make them easier to navigate with the keyboard.
1377+
当你的组件开始觉得密集或难以阅读时,在多个属性之间添加空行可以让其变得容易。在一些诸如 Vim 的编辑器里,这样格式化后的选项还能通过键盘被快速导航。
13781378

13791379
{% raw %}<div class="style-example example-good">{% endraw %}
13801380
#### 好例子
@@ -1407,8 +1407,7 @@ computed: {
14071407
```
14081408

14091409
``` js
1410-
// No spaces are also fine, as long as the component
1411-
// is still easy to read and navigate.
1410+
// 没有空行在组件易于阅读和导航时也没问题。
14121411
props: {
14131412
value: {
14141413
type: String,
@@ -1434,9 +1433,9 @@ computed: {
14341433

14351434

14361435

1437-
### Single-file component top-level element order <sup data-p="c">recommended</sup>
1436+
### 单文件组件的顶级元素的顺序 <sup data-p="c">推荐</sup>
14381437

1439-
**[Single-file components](../guide/single-file-components.html) should always order `template`, `script`, and `style` tags consistently, with `<style>` last, because at least one of the other two is always necessary.**
1438+
**[单文件组件](../guide/single-file-components.html)应该总是让 `template``script` `style` 标签的顺序保持一致。且 `<style>` 要放在最后,因为另外两个标签至少要有一个。**
14401439

14411440
{% raw %}<div class="style-example example-bad">{% endraw %}
14421441
#### 反例

0 commit comments

Comments
 (0)