tangjinzhou
7 years ago
12 changed files with 193 additions and 1 deletions
@ -0,0 +1,23 @@
|
||||
<cn> |
||||
#### 水平分割线 |
||||
默认为水平分割线,可在中间加入文字。 |
||||
</cn> |
||||
|
||||
<us> |
||||
#### Horizontal |
||||
Divider default type is `horizontal`. Support inner text inside Divider. |
||||
</us> |
||||
|
||||
```html |
||||
<template> |
||||
<div> |
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p> |
||||
<a-divider /> |
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p> |
||||
<a-divider>With Text</a-divider> |
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p> |
||||
<a-divider dashed /> |
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista probare, quae sunt a te dicta? Refert tamen, quo modo.</p> |
||||
</div> |
||||
</template> |
||||
``` |
@ -0,0 +1,34 @@
|
||||
<script> |
||||
import Horizontal from './horizontal' |
||||
import Vertical from './vertical' |
||||
import CN from '../index.zh-CN.md' |
||||
import US from '../index.en-US.md' |
||||
const md = { |
||||
cn: `# 分割线 |
||||
区隔内容的分割线。 |
||||
## 何时使用 |
||||
- 对不同章节的文本段落进行分割。 |
||||
- 对行内文字/链接进行分割,例如表格的操作列。 |
||||
## 代码演示`, |
||||
us: `# Divider |
||||
A divider line separates different content. |
||||
## When To Use |
||||
- Divide sections of article. |
||||
- Divide inline text and links such as the operation column of table.`, |
||||
} |
||||
export default { |
||||
render () { |
||||
return ( |
||||
<div> |
||||
<md cn={md.cn} us={md.us}/> |
||||
<Vertical /> |
||||
<Horizontal /> |
||||
<api> |
||||
<CN slot='cn' /> |
||||
<US/> |
||||
</api> |
||||
</div> |
||||
) |
||||
}, |
||||
} |
||||
</script> |
@ -0,0 +1,21 @@
|
||||
<cn> |
||||
#### 垂直分割线 |
||||
使用 `type="vertical"` 设置为行内的垂直分割线。 |
||||
</cn> |
||||
|
||||
<us> |
||||
#### Vertical |
||||
Use `type="vertical"` make it vertical. |
||||
</us> |
||||
|
||||
```html |
||||
<template> |
||||
<div> |
||||
Text |
||||
<a-divider type="vertical" /> |
||||
<a href="#">Link</a> |
||||
<a-divider type="vertical" /> |
||||
<a href="#">Link</a> |
||||
</div> |
||||
</template> |
||||
``` |
@ -0,0 +1,8 @@
|
||||
## API |
||||
|
||||
### Divider |
||||
|
||||
| Property | Description | Type | Default | |
||||
| -------- | ----------- | ---- | ------- | |
||||
| dashed | whether line is dasded | Boolean | false | |
||||
| type | direction type of divider | enum: `horizontal` `vertical` | `horizontal` | |
@ -0,0 +1,28 @@
|
||||
<script> |
||||
import PropTypes from '../_util/vue-types' |
||||
export default { |
||||
props: { |
||||
prefixCls: PropTypes.string.def('ant'), |
||||
type: PropTypes.oneOf(['horizontal', 'vertical']).def('horizontal'), |
||||
dashed: PropTypes.bool, |
||||
}, |
||||
computed: { |
||||
classString () { |
||||
const { prefixCls, type, $slots, dashed } = this |
||||
return { |
||||
[`${prefixCls}-divider`]: true, [`${prefixCls}-divider-${type}`]: true, |
||||
[`${prefixCls}-divider-with-text`]: $slots.default, |
||||
[`${prefixCls}-divider-dashed`]: !!dashed, |
||||
} |
||||
}, |
||||
}, |
||||
render () { |
||||
const { classString, prefixCls, $slots } = this |
||||
return ( |
||||
<div class={classString}> |
||||
{$slots.default && <span className={`${prefixCls}-divider-inner-text`}>{$slots.default}</span>} |
||||
</div> |
||||
) |
||||
}, |
||||
} |
||||
</script> |
@ -0,0 +1,6 @@
|
||||
## API |
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | |
||||
| --- | --- | --- | --- | |
||||
| dashed | 是否虚线 | Boolean | false | |
||||
| type | 水平还是垂直类型 | enum: `horizontal` `vertical` | `horizontal` | |
@ -0,0 +1,2 @@
|
||||
import '../../style/index.less' |
||||
import './index.less' |
@ -0,0 +1,65 @@
|
||||
@import "../../style/themes/default"; |
||||
@import "../../style/mixins/index"; |
||||
|
||||
@divider-prefix-cls: ~"@{ant-prefix}-divider"; |
||||
|
||||
.@{divider-prefix-cls} { |
||||
.reset-component; |
||||
background: @border-color-split; |
||||
|
||||
&, // for compatiable |
||||
&-vertical { |
||||
margin: 0 8px; |
||||
display: inline-block; |
||||
height: 0.9em; |
||||
width: 1px; |
||||
vertical-align: middle; |
||||
position: relative; |
||||
top: -0.06em; |
||||
} |
||||
&-horizontal { |
||||
display: block; |
||||
height: 1px; |
||||
width: 100%; |
||||
margin: 24px 0; |
||||
} |
||||
&-horizontal&-with-text { |
||||
display: table; |
||||
white-space: nowrap; |
||||
text-align: center; |
||||
background: transparent; |
||||
font-weight: 500; |
||||
color: @heading-color; |
||||
font-size: @font-size-lg; |
||||
margin: 16px 0; |
||||
|
||||
&:before, |
||||
&:after { |
||||
content: ''; |
||||
display: table-cell; |
||||
position: relative; |
||||
top: 50%; |
||||
width: 50%; |
||||
border-top: 1px solid @border-color-split; |
||||
transform: translateY(50%); |
||||
} |
||||
} |
||||
|
||||
&-inner-text { |
||||
display: inline-block; |
||||
padding: 0 24px; |
||||
} |
||||
|
||||
&-dashed { |
||||
background: none; |
||||
border-top: 1px dashed @border-color-split; |
||||
} |
||||
|
||||
&-horizontal&-with-text&-dashed { |
||||
border-top: 0; |
||||
&:before, |
||||
&:after { |
||||
border-style: dashed none none; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue