Collapse: update English doc

pull/2012/head
Leopoldthecoder 2016-12-27 14:54:57 +08:00
parent e13b133afd
commit 8425a0aa1a
1 changed files with 45 additions and 54 deletions

View File

@ -13,43 +13,34 @@
} }
} }
</script> </script>
<style>
.demo-collapse {
.el-collapse-item__header {
.header-icon {
margin-left: 5px;
}
}
}
</style>
## Collapse ## Collapse
Use Collapse to storage content. Use Collapse to store contents.
### Basic usage ### Basic usage
可同时展开多个面板,面板之间不影响 You can expand multiple panels
:::demo :::demo
```html ```html
<el-collapse v-model="activeNames" @change="handleChange"> <el-collapse v-model="activeNames" @change="handleChange">
<el-collapse-item title="Consistency" name="1"> <el-collapse-item title="Consistency" name="1">
<div>与现实生活一致:与现实生活的流程、逻辑保持一致,遵循用户习惯的语言和概念;</div> <div>Consistent with real life: in line with the process and logic of real life, and comply with languages and habits that the users are used to;</div>
<div>在界面中一致:所有的元素和结构需保持一致,比如:设计样式、图标和文本、元素的位置等。</div> <div>Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Feedback" name="2"> <el-collapse-item title="Feedback" name="2">
<div>控制反馈:通过界面样式和交互动效让用户可以清晰的感知自己的操作;</div> <div>Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;</div>
<div>页面反馈:操作后,通过页面元素的变化清晰地展现当前状态。</div> <div>Visual feedback: reflect current state by updating or rearranging elements of the page.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Efficiency" name="3"> <el-collapse-item title="Efficiency" name="3">
<div>简化流程:设计简洁直观的操作流程;</div> <div>Simplify the process: keep operating process simple and intuitive;</div>
<div>清晰明确:语言表达清晰且表意明确,让用户快速理解进而作出决策;</div> <div>Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;</div>
<div>帮助用户识别:界面简单直白,让用户快速识别而非回忆,减少用户记忆负担。</div> <div>Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Controllability" name="4"> <el-collapse-item title="Controllability" name="4">
<div>用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;</div> <div>Decision making: giving advices about operations is acceptable, but do not make decisions for the users;</div>
<div>结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。</div> <div>Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.</div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<script> <script>
@ -66,27 +57,27 @@ Use Collapse to storage content.
### Accordion ### Accordion
At the same time only one item can be opened. In accordion mode, only one panel can be expanded at once
:::demo 通过 `accordion` 属性来设置是否以手风琴模式显示。 :::demo Activate accordion mode using the `accordion` attribute.
```html ```html
<el-collapse v-model="activeName" accordion> <el-collapse v-model="activeName" accordion>
<el-collapse-item title="Consistency" name="1"> <el-collapse-item title="Consistency" name="1">
<div>与现实生活一致:与现实生活的流程、逻辑保持一致,遵循用户习惯的语言和概念;</div> <div>Consistent with real life: in line with the process and logic of real life, and comply with languages and habits that the users are used to;</div>
<div>在界面中一致:所有的元素和结构需保持一致,比如:设计样式、图标和文本、元素的位置等。</div> <div>Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Feedback" name="2"> <el-collapse-item title="Feedback" name="2">
<div>控制反馈:通过界面样式和交互动效让用户可以清晰的感知自己的操作;</div> <div>Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;</div>
<div>页面反馈:操作后,通过页面元素的变化清晰地展现当前状态。</div> <div>Visual feedback: reflect current state by updating or rearranging elements of the page.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Efficiency" name="3"> <el-collapse-item title="Efficiency" name="3">
<div>简化流程:设计简洁直观的操作流程;</div> <div>Simplify the process: keep operating process simple and intuitive;</div>
<div>清晰明确:语言表达清晰且表意明确,让用户快速理解进而作出决策;</div> <div>Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;</div>
<div>帮助用户识别:界面简单直白,让用户快速识别而非回忆,减少用户记忆负担。</div> <div>Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Controllability" name="4"> <el-collapse-item title="Controllability" name="4">
<div>用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;</div> <div>Decision making: giving advices about operations is acceptable, but do not make decisions for the users;</div>
<div>结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。</div> <div>Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.</div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
<script> <script>
@ -101,50 +92,50 @@ At the same time only one item can be opened.
``` ```
::: :::
### Customize Title ### Custom title
除了可以通过 `title` 属性以外,还可以通过作用域插槽来实现自定义面板的标题内容,以实现增加图标等效果。 Besides using the `title` attribute, you can customize panel title with scoped slots, which makes adding custom content, e.g. icons, possible.
:::demo :::demo
```html ```html
<el-collapse accordion> <el-collapse accordion>
<el-collapse-item title="Consistency"> <el-collapse-item title="Consistency" name="1">
<template slot="title" scope="props"> <template slot="title" scope="props">
{{props.title}}<i class="header-icon el-icon-information"></i> {{props.title}}<i class="header-icon el-icon-information"></i>
</template> </template>
<div>与现实生活一致:与现实生活的流程、逻辑保持一致,遵循用户习惯的语言和概念;</div> <div>Consistent with real life: in line with the process and logic of real life, and comply with languages and habits that the users are used to;</div>
<div>在界面中一致:所有的元素和结构需保持一致,比如:设计样式、图标和文本、元素的位置等。</div> <div>Consistent within interface: all elements should be consistent, such as: design style, icons and texts, position of elements, etc.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Feedback"> <el-collapse-item title="Feedback" name="2">
<div>控制反馈:通过界面样式和交互动效让用户可以清晰的感知自己的操作;</div> <div>Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;</div>
<div>页面反馈:操作后,通过页面元素的变化清晰地展现当前状态。</div> <div>Visual feedback: reflect current state by updating or rearranging elements of the page.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Efficiency"> <el-collapse-item title="Efficiency" name="3">
<div>简化流程:设计简洁直观的操作流程;</div> <div>Simplify the process: keep operating process simple and intuitive;</div>
<div>清晰明确:语言表达清晰且表意明确,让用户快速理解进而作出决策;</div> <div>Definite and clear: enunciate your intentions clearly so that the users can quickly understand and make decisions;</div>
<div>帮助用户识别:界面简单直白,让用户快速识别而非回忆,减少用户记忆负担。</div> <div>Easy to identify: the interface should be straightforward, which helps the users to identify and frees them from memorizing and recalling.</div>
</el-collapse-item> </el-collapse-item>
<el-collapse-item title="Controllability"> <el-collapse-item title="Controllability" name="4">
<div>用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;</div> <div>Decision making: giving advices about operations is acceptable, but do not make decisions for the users;</div>
<div>结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。</div> <div>Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or terminating current operation.</div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
``` ```
::: :::
### Collapse Attributes ### Collapse Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- | |---------- |-------------- |---------- |-------------------------------- |-------- |
| accordion | 是否手风琴模式 | boolean | — | false | | accordion | whether to activate accordion mode | boolean | — | false |
| value | 当前激活的面板(如果是手风琴模式,绑定值类型需要为`string`,否则为`array`) | string/array | — | — | | value | currently active panel | string (accordion mode)/array (non-accordion mode) | — | — |
### Collapse Events ### Collapse Events
| 事件名称 | 说明 | 回调参数 | | Event Name | Description | Parameters |
|---------|---------|---------| |---------|---------|---------|
| change | 当前激活面板改变时触发(如果是手风琴模式,参数 `activeNames` 类型为`string`,否则为`array`) | (activeNames: array\|string) | | change | triggers when active panels change | activeNames: array (non-accordion mode)/string (accordion mode) |
### Collapse Item Attributes ### Collapse Item Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | Attribute | Description | Type | Accepted Values | Default |
|---------- |-------------- |---------- |-------------------------------- |-------- | |---------- |-------------- |---------- |-------------------------------- |-------- |
| name | 唯一标志符 | string/number | — | — | | name | unique identification of the panel | string/number | — | — |
| title | 面板标题 | string | — | — | | title | title of the panel | string | — | — |