diff --git a/components.json b/components.json
index 9b9ebc795..f595fd87a 100644
--- a/components.json
+++ b/components.json
@@ -69,5 +69,6 @@
"main": "./packages/main/index.js",
"footer": "./packages/footer/index.js",
"timeline": "./packages/timeline/index.js",
- "timeline-item": "./packages/timeline-item/index.js"
+ "timeline-item": "./packages/timeline-item/index.js",
+ "divider": "./packages/divider/index.js"
}
diff --git a/examples/demo-styles/divider.scss b/examples/demo-styles/divider.scss
new file mode 100644
index 000000000..a4cd0c07c
--- /dev/null
+++ b/examples/demo-styles/divider.scss
@@ -0,0 +1,9 @@
+.demo-divider-container-1 {
+ display: inline-block;
+ width: 33%;
+}
+
+.demo-divider-container-2 {
+ display: inline-block;
+ width: 50%;
+}
\ No newline at end of file
diff --git a/examples/demo-styles/index.scss b/examples/demo-styles/index.scss
index 95458e83b..26e3ad7cd 100644
--- a/examples/demo-styles/index.scss
+++ b/examples/demo-styles/index.scss
@@ -38,3 +38,4 @@
@import "./tree.scss";
@import "./typography.scss";
@import "./upload.scss";
+@import "./divider.scss";
diff --git a/examples/docs/en-US/divider.md b/examples/docs/en-US/divider.md
new file mode 100644
index 000000000..d419c9bd9
--- /dev/null
+++ b/examples/docs/en-US/divider.md
@@ -0,0 +1,61 @@
+## Divider
+
+The dividing line that separates the content.
+
+### Basic usage
+
+Divide the text of different paragraphs.
+
+:::demo
+```html
+
+
+ I sit at my window this morning where the world like a passer-by stops for a moment, nods to me and goes.
+
+ There little thoughts are the rustle of leaves; they have their whisper of joy in my mind.
+
+
+```
+:::
+
+### Custom content
+
+You can customize the content on the divider line.
+
+
+:::demo
+```html
+
+
+ What you are you do not see, what you see is your shadow.
+ Rabindranath Tagore
+ I cannot choose the best. The best chooses me.
+
+ My wishes are fools, they shout across thy song, my Master. Let me but listen.
+ Rabindranath Tagore
+
+
+```
+:::
+
+### Vertical divider
+
+:::demo
+```html
+
+
+ Rain
+
+ Home
+
+ Grass
+
+
+```
+:::
+
+### Divider Attributes
+| Attribute | Description | Type | Accepted Values | Default |
+|------------- |---------------- |---------------- |---------------------- |-------- |
+| direction | Set divider's direction | string | horizontal / vertical | horizontal |
+| content-position | customize the content on the divider line | String | left / right / center | center |
\ No newline at end of file
diff --git a/examples/docs/es/divider.md b/examples/docs/es/divider.md
new file mode 100644
index 000000000..d419c9bd9
--- /dev/null
+++ b/examples/docs/es/divider.md
@@ -0,0 +1,61 @@
+## Divider
+
+The dividing line that separates the content.
+
+### Basic usage
+
+Divide the text of different paragraphs.
+
+:::demo
+```html
+
+
+ I sit at my window this morning where the world like a passer-by stops for a moment, nods to me and goes.
+
+ There little thoughts are the rustle of leaves; they have their whisper of joy in my mind.
+
+
+```
+:::
+
+### Custom content
+
+You can customize the content on the divider line.
+
+
+:::demo
+```html
+
+
+ What you are you do not see, what you see is your shadow.
+ Rabindranath Tagore
+ I cannot choose the best. The best chooses me.
+
+ My wishes are fools, they shout across thy song, my Master. Let me but listen.
+ Rabindranath Tagore
+
+
+```
+:::
+
+### Vertical divider
+
+:::demo
+```html
+
+
+ Rain
+
+ Home
+
+ Grass
+
+
+```
+:::
+
+### Divider Attributes
+| Attribute | Description | Type | Accepted Values | Default |
+|------------- |---------------- |---------------- |---------------------- |-------- |
+| direction | Set divider's direction | string | horizontal / vertical | horizontal |
+| content-position | customize the content on the divider line | String | left / right / center | center |
\ No newline at end of file
diff --git a/examples/docs/fr-FR/divider.md b/examples/docs/fr-FR/divider.md
new file mode 100644
index 000000000..d419c9bd9
--- /dev/null
+++ b/examples/docs/fr-FR/divider.md
@@ -0,0 +1,61 @@
+## Divider
+
+The dividing line that separates the content.
+
+### Basic usage
+
+Divide the text of different paragraphs.
+
+:::demo
+```html
+
+
+ I sit at my window this morning where the world like a passer-by stops for a moment, nods to me and goes.
+
+ There little thoughts are the rustle of leaves; they have their whisper of joy in my mind.
+
+
+```
+:::
+
+### Custom content
+
+You can customize the content on the divider line.
+
+
+:::demo
+```html
+
+
+ What you are you do not see, what you see is your shadow.
+ Rabindranath Tagore
+ I cannot choose the best. The best chooses me.
+
+ My wishes are fools, they shout across thy song, my Master. Let me but listen.
+ Rabindranath Tagore
+
+
+```
+:::
+
+### Vertical divider
+
+:::demo
+```html
+
+
+ Rain
+
+ Home
+
+ Grass
+
+
+```
+:::
+
+### Divider Attributes
+| Attribute | Description | Type | Accepted Values | Default |
+|------------- |---------------- |---------------- |---------------------- |-------- |
+| direction | Set divider's direction | string | horizontal / vertical | horizontal |
+| content-position | customize the content on the divider line | String | left / right / center | center |
\ No newline at end of file
diff --git a/examples/docs/zh-CN/divider.md b/examples/docs/zh-CN/divider.md
new file mode 100644
index 000000000..190a29154
--- /dev/null
+++ b/examples/docs/zh-CN/divider.md
@@ -0,0 +1,61 @@
+## Divider 分割线
+
+区隔内容的分割线。
+
+### 基础用法
+
+对不同章节的文本段落进行分割。
+
+:::demo
+```html
+
+
+ 青春是一个短暂的美梦, 当你醒来时, 它早已消失无踪
+
+ 少量的邪恶足以抵消全部高贵的品质, 害得人声名狼藉
+
+
+```
+:::
+
+### 设置文案
+
+可以在分割线上自定义文案内容。
+
+
+:::demo
+```html
+
+
+ 头上一片晴天,心中一个想念
+ 少年包青天
+ 饿了别叫妈, 叫饿了么
+
+ 为了无法计算的价值
+ 阿里云
+
+
+```
+:::
+
+### 垂直分割
+
+:::demo
+```html
+
+
+ 雨纷纷
+
+ 旧故里
+
+ 草木深
+
+
+```
+:::
+
+### Divider Attributes
+| 参数 | 说明 | 类型 | 可选值 | 默认值 |
+|------------- |---------------- |---------------- |---------------------- |-------- |
+| direction | 设置分割线方向 | boolean | horizontal / vertical | horizontal |
+| content-position | 设置分割线文案的位置 | string | left / right / center | center |
\ No newline at end of file
diff --git a/examples/nav.config.json b/examples/nav.config.json
index f331f9ead..40a3e3de9 100644
--- a/examples/nav.config.json
+++ b/examples/nav.config.json
@@ -251,6 +251,10 @@
{
"path": "/timeline",
"title": "Timeline 时间线"
+ },
+ {
+ "path": "/divider",
+ "title": "Divider 分割线"
}
]
}
@@ -509,6 +513,10 @@
{
"path": "/timeline",
"title": "Timeline"
+ },
+ {
+ "path": "/divider",
+ "title": "Divider"
}
]
}
@@ -767,6 +775,10 @@
{
"path": "/timeline",
"title": "Timeline"
+ },
+ {
+ "path": "/divider",
+ "title": "Divider"
}
]
}
@@ -1025,6 +1037,10 @@
{
"path": "/timeline",
"title": "Timeline"
+ },
+ {
+ "path": "/divider",
+ "title": "Divider"
}
]
}
diff --git a/packages/divider/index.js b/packages/divider/index.js
new file mode 100644
index 000000000..b49f9d0fe
--- /dev/null
+++ b/packages/divider/index.js
@@ -0,0 +1,8 @@
+import Divider from './src/main';
+
+/* istanbul ignore next */
+Divider.install = function(Vue) {
+ Vue.component(Divider.name, Divider);
+};
+
+export default Divider;
diff --git a/packages/divider/src/main.js b/packages/divider/src/main.js
new file mode 100644
index 000000000..e44181476
--- /dev/null
+++ b/packages/divider/src/main.js
@@ -0,0 +1,37 @@
+export default {
+ functional: true,
+
+ name: 'ElDivider',
+
+ props: {
+ direction: {
+ type: String,
+ default: 'horizontal',
+ validator(val) {
+ return ['horizontal', 'vertical'].indexOf(val) !== -1;
+ }
+ },
+
+ contentPosition: {
+ type: String,
+ default: 'center',
+ validator(val) {
+ return ['left', 'center', 'right'].indexOf(val) !== -1;
+ }
+ }
+ },
+
+ render(h, context) {
+ const $slots = context.slots();
+ const { direction, contentPosition } = context.props;
+ return (
+
+ {
+ $slots.default && direction !== 'vertical'
+ ?
{$slots.default}
+ : null
+ }
+
+ );
+ }
+};
diff --git a/packages/theme-chalk/src/divider.scss b/packages/theme-chalk/src/divider.scss
new file mode 100644
index 000000000..4ed94ee59
--- /dev/null
+++ b/packages/theme-chalk/src/divider.scss
@@ -0,0 +1,47 @@
+@import "common/var";
+@import "mixins/mixins";
+
+@include b(divider) {
+ background-color: $--border-color-base;
+ position: relative;
+
+ @include m(horizontal) {
+ display: block;
+ height: 1px;
+ width: 100%;
+ margin: 24px 0;
+ }
+
+ @include m(vertical) {
+ display: inline-block;
+ width: 1px;
+ height: 1em;
+ margin: 0 8px;
+ vertical-align: middle;
+ position: relative;
+ }
+
+ @include e(text) {
+ position: absolute;
+ background-color: $--color-white;
+ padding: 0 20px;
+ font-weight: 500;
+ color: $--color-text-primary;
+ font-size: 14px;
+
+ @include when(left) {
+ left: 20px;
+ transform: translateY(-50%);
+ }
+
+ @include when(center) {
+ left: 50%;
+ transform: translateX(-50%) translateY(-50%);
+ }
+
+ @include when(right) {
+ right: 20px;
+ transform: translateY(-50%);
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/theme-chalk/src/index.scss b/packages/theme-chalk/src/index.scss
index d644e304f..4051e6434 100644
--- a/packages/theme-chalk/src/index.scss
+++ b/packages/theme-chalk/src/index.scss
@@ -67,3 +67,4 @@
@import "./footer.scss";
@import "./timeline.scss";
@import "./timeline-item.scss";
+@import "./divider.scss";
diff --git a/src/index.js b/src/index.js
index b710a57db..ef603ee86 100644
--- a/src/index.js
+++ b/src/index.js
@@ -71,6 +71,7 @@ import Main from '../packages/main/index.js';
import Footer from '../packages/footer/index.js';
import Timeline from '../packages/timeline/index.js';
import TimelineItem from '../packages/timeline-item/index.js';
+import Divider from '../packages/divider/index.js';
import locale from 'element-ui/src/locale';
import CollapseTransition from 'element-ui/src/transitions/collapse-transition';
@@ -142,6 +143,7 @@ const components = [
Footer,
Timeline,
TimelineItem,
+ Divider,
CollapseTransition
];
@@ -251,5 +253,6 @@ export default {
Main,
Footer,
Timeline,
- TimelineItem
+ TimelineItem,
+ Divider
};
diff --git a/test/unit/specs/divider.spec.js b/test/unit/specs/divider.spec.js
new file mode 100644
index 000000000..1a0560ab8
--- /dev/null
+++ b/test/unit/specs/divider.spec.js
@@ -0,0 +1,28 @@
+import { createVue, destroyVM } from '../util';
+
+describe('Divider', () => {
+ let vm;
+ afterEach(() => {
+ destroyVM(vm);
+ });
+
+ it('content', () => {
+ vm = createVue({
+ template: `
+ 我是一条完美分割线!
+ `
+ });
+
+ expect(vm.$el).to.property('textContent').to.include('我是一条完美分割线!');
+ });
+
+ it('direction', () => {
+ vm = createVue({
+ template: `
+ 我是一条完美分割线!
+ `
+ });
+
+ expect(vm.$el.className).to.include('el-divider--vertical');
+ });
+});
diff --git a/types/divider.d.ts b/types/divider.d.ts
new file mode 100644
index 000000000..c7d969cc2
--- /dev/null
+++ b/types/divider.d.ts
@@ -0,0 +1,12 @@
+import { ElementUIComponent } from './component'
+
+export type ContentPosition = 'left' | 'center' | 'right'
+
+/** Divider Component */
+export declare class ElDivider extends ElementUIComponent {
+ /** enable vertical divider */
+ vertical: boolean
+
+ /** customize the content on the divider line */
+ posiiton: ContentPosition
+}
diff --git a/types/element-ui.d.ts b/types/element-ui.d.ts
index 2c341a8e5..4af76cacb 100644
--- a/types/element-ui.d.ts
+++ b/types/element-ui.d.ts
@@ -69,6 +69,7 @@ import { ElTooltip } from './tooltip'
import { ElTransfer } from './transfer'
import { ElTree } from './tree'
import { ElUpload } from './upload'
+import { ElDivider } from './divider'
export interface InstallationOptions {
locale: any,
@@ -300,3 +301,6 @@ export class Tree extends ElTree {}
/** Upload Component */
export class Upload extends ElUpload {}
+
+/** Divider Component */
+export class Divider extends ElDivider {}