Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
e3ab79e5
Commit
e3ab79e5
authored
Jan 11, 2017
by
qingwei.li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Steps: add center property, resolve #2315
parent
86884716
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
6 deletions
+29
-6
examples/docs/en-US/steps.md
examples/docs/en-US/steps.md
+1
-0
examples/docs/zh-CN/steps.md
examples/docs/zh-CN/steps.md
+1
-0
packages/steps/src/step.vue
packages/steps/src/step.vue
+15
-4
packages/steps/src/steps.vue
packages/steps/src/steps.vue
+8
-2
packages/theme-default/src/steps.css
packages/theme-default/src/steps.css
+4
-0
No files found.
examples/docs/en-US/steps.md
View file @
e3ab79e5
...
...
@@ -120,6 +120,7 @@ Vertical step bars.
| process-status | status of current step | string | wait/process/finish/error/success | process |
| finish-status | status of end step | string | wait/process/finish/error/success | finish |
| align-center | whether step description is centered | boolean | — | false |
| center | center whole
`Steps`
component | boolean | false, true | false |
### Step Attributes
| Attribute | Description | Type | Accepted Values | Default |
...
...
examples/docs/zh-CN/steps.md
View file @
e3ab79e5
...
...
@@ -114,6 +114,7 @@
| process-status | 设置当前步骤的状态 | string | wait/process/finish/error/success | process |
| finish-status | 设置结束步骤的状态 | string | wait/process/finish/error/success | finish |
| align-center | 标题描述居中对齐 | boolean | false, true | false |
| center | 组件居中显示 | boolean | false, true | false |
### Step Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
...
...
packages/steps/src/step.vue
View file @
e3ab79e5
<
template
>
<div
class=
"el-step"
:style=
"
style
"
:style=
"
[style, isLast ? '' :
{ marginRight: - $parent.stepOffset + 'px' }]
"
:class="['is-' + $parent.direction]">
<div
class=
"el-step__head"
:class=
"['is-' + currentStatus,
{ 'is-text': !icon }]">
<div
class=
"el-step__line"
:class=
"['is-' + $parent.direction,
{ 'is-icon': icon }]">
:style=
"isLast ? '' :
{ marginRight: $parent.stepOffset + 'px' }"
:class="['is-' + $parent.direction, { 'is-icon': icon }]">
<i
class=
"el-step__line-inner"
:style=
"lineStyle"
></i>
</div>
...
...
@@ -63,6 +64,7 @@ export default {
style
:
{},
lineStyle
:
{},
mainOffset
:
0
,
isLast
:
false
,
currentStatus
:
this
.
status
};
},
...
...
@@ -103,22 +105,31 @@ export default {
:
style
.
width
=
step
+
'
%
'
;
this
.
lineStyle
=
style
;
},
adjustPosition
()
{
this
.
style
=
{};
this
.
$parent
.
stepOffset
=
this
.
$el
.
getBoundingClientRect
().
width
/
(
this
.
$parent
.
steps
.
length
-
1
);
}
},
mounted
()
{
const
parent
=
this
.
$parent
;
const
isCenter
=
parent
.
center
;
const
len
=
parent
.
steps
.
length
;
const
isLast
=
this
.
isLast
=
parent
.
steps
[
parent
.
steps
.
length
-
1
]
===
this
;
const
space
=
parent
.
space
?
parent
.
space
+
'
px
'
:
100
/
parent
.
steps
.
length
+
'
%
'
;
:
100
/
(
isCenter
?
len
-
1
:
len
)
+
'
%
'
;
if
(
parent
.
direction
===
'
horizontal
'
)
{
this
.
style
=
{
width
:
space
};
if
(
parent
.
alignCenter
)
{
this
.
mainOffset
=
-
this
.
$refs
.
title
.
getBoundingClientRect
().
width
/
2
+
16
+
'
px
'
;
}
isCenter
&&
isLast
&&
this
.
adjustPosition
();
}
else
{
if
(
parent
.
steps
[
parent
.
steps
.
length
-
1
]
!==
this
)
{
if
(
!
isLast
)
{
this
.
style
=
{
height
:
space
};
}
}
...
...
packages/steps/src/steps.vue
View file @
e3ab79e5
<
template
>
<div
class=
"el-steps"
:class=
"['is-' + direction]"
><slot></slot></div>
<div
class=
"el-steps"
:class=
"['is-' + direction, center ? 'is-center' : '']"
>
<slot></slot>
</div>
</
template
>
<
script
>
...
...
@@ -14,6 +18,7 @@ export default {
default
:
'
horizontal
'
},
alignCenter
:
Boolean
,
center
:
Boolean
,
finishStatus
:
{
type
:
String
,
default
:
'
finish
'
...
...
@@ -26,7 +31,8 @@ export default {
data
()
{
return
{
steps
:
[]
steps
:
[],
stepOffset
:
0
};
},
...
...
packages/theme-default/src/steps.css
View file @
e3ab79e5
...
...
@@ -11,6 +11,10 @@
@when
horizontal
{
white-space
:
nowrap
;
@when
center
{
text-align
:
center
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment