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
a6016a5c
Commit
a6016a5c
authored
Sep 06, 2017
by
Leopoldthecoder
Committed by
杨奕
Sep 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alert: add chalk theme
parent
a1e8c52d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
113 additions
and
23 deletions
+113
-23
examples/docs/en-US/alert.md
examples/docs/en-US/alert.md
+37
-0
examples/docs/en-US/message.md
examples/docs/en-US/message.md
+1
-1
examples/docs/zh-CN/alert.md
examples/docs/zh-CN/alert.md
+36
-0
examples/docs/zh-CN/message.md
examples/docs/zh-CN/message.md
+1
-1
packages/alert/src/main.vue
packages/alert/src/main.vue
+6
-8
packages/theme-chalk/src/alert.scss
packages/theme-chalk/src/alert.scss
+27
-7
packages/theme-chalk/src/common/var.scss
packages/theme-chalk/src/common/var.scss
+4
-4
packages/theme-chalk/src/message.scss
packages/theme-chalk/src/message.scss
+1
-1
test/unit/specs/alert.spec.js
test/unit/specs/alert.spec.js
+0
-1
No files found.
examples/docs/en-US/alert.md
View file @
a6016a5c
...
@@ -118,6 +118,42 @@ Displaying an icon improves readability.
...
@@ -118,6 +118,42 @@ Displaying an icon improves readability.
```
```
:::
:::
## Centered text
Use the
`center`
attribute to center the text.
::: demo
```
html
<template>
<el-alert
title=
"success alert"
type=
"success"
center
show-icon
>
</el-alert>
<el-alert
title=
"info alert"
type=
"info"
center
show-icon
>
</el-alert>
<el-alert
title=
"warning alert"
type=
"warning"
center
show-icon
>
</el-alert>
<el-alert
title=
"error alert"
type=
"error"
center
show-icon
>
</el-alert>
</template>
```
:::
### With description
### With description
Description includes a message with more detailed information.
Description includes a message with more detailed information.
...
@@ -176,6 +212,7 @@ Description includes a message with more detailed information.
...
@@ -176,6 +212,7 @@ Description includes a message with more detailed information.
| type | component type | string | success/warning/info/error | info |
| type | component type | string | success/warning/info/error | info |
| description | descriptive text. Can also be passed with the default slot | string | — | — |
| description | descriptive text. Can also be passed with the default slot | string | — | — |
| closable | if closable or not | boolean | — | true |
| closable | if closable or not | boolean | — | true |
| center | whether to center the text | boolean | — | false |
| close-text | customized close button text | string | — | — |
| close-text | customized close button text | string | — | — |
| show-icon | if a type icon is displayed | boolean | — | false |
| show-icon | if a type icon is displayed | boolean | — | false |
...
...
examples/docs/en-US/message.md
View file @
a6016a5c
...
@@ -214,7 +214,7 @@ A close button can be added.
...
@@ -214,7 +214,7 @@ A close button can be added.
:::
:::
### Centered text
### Centered text
Use the
`center`
attribute to center the text
Use the
`center`
attribute to center the text
.
:::demo
:::demo
...
...
examples/docs/zh-CN/alert.md
View file @
a6016a5c
...
@@ -115,6 +115,41 @@
...
@@ -115,6 +115,41 @@
```
```
:::
:::
### 文字居中
使用
`center`
属性让文字水平居中。
::: demo
```
html
<template>
<el-alert
title=
"成功提示的文案"
type=
"success"
center
show-icon
>
</el-alert>
<el-alert
title=
"消息提示的文案"
type=
"info"
center
show-icon
>
</el-alert>
<el-alert
title=
"警告提示的文案"
type=
"warning"
center
show-icon
>
</el-alert>
<el-alert
title=
"错误提示的文案"
type=
"error"
center
show-icon
>
</el-alert>
</template>
```
:::
### 带有辅助性文字介绍
### 带有辅助性文字介绍
包含标题和内容,解释更详细的警告。
包含标题和内容,解释更详细的警告。
...
@@ -171,6 +206,7 @@
...
@@ -171,6 +206,7 @@
| type | 主题 | string | success/warning/info/error | info |
| type | 主题 | string | success/warning/info/error | info |
| description | 辅助性文字。也可通过默认 slot 传入 | string | — | — |
| description | 辅助性文字。也可通过默认 slot 传入 | string | — | — |
| closable | 是否可关闭 | boolean | — | true |
| closable | 是否可关闭 | boolean | — | true |
| center | 文字是否居中 | boolean | — | true |
| close-text | 关闭按钮自定义文本 | string | — | — |
| close-text | 关闭按钮自定义文本 | string | — | — |
| show-icon | 是否显示图标 | boolean | — | false |
| show-icon | 是否显示图标 | boolean | — | false |
...
...
examples/docs/zh-CN/message.md
View file @
a6016a5c
...
@@ -214,7 +214,7 @@
...
@@ -214,7 +214,7 @@
:::
:::
### 文字居中
### 文字居中
使用
`center`
属性让文字水平居中
使用
`center`
属性让文字水平居中
。
:::demo
:::demo
...
...
packages/alert/src/main.vue
View file @
a6016a5c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<transition
name=
"el-alert-fade"
>
<transition
name=
"el-alert-fade"
>
<div
<div
class=
"el-alert"
class=
"el-alert"
:class=
"[
typeClass
]"
:class=
"[
typeClass, center ? 'is-center' : ''
]"
v-show=
"visible"
v-show=
"visible"
role=
"alert"
role=
"alert"
>
>
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
<
script
type=
"text/babel"
>
<
script
type=
"text/babel"
>
const
TYPE_CLASSES_MAP
=
{
const
TYPE_CLASSES_MAP
=
{
'
success
'
:
'
el-icon-
circle-check
'
,
'
success
'
:
'
el-icon-
success
'
,
'
warning
'
:
'
el-icon-warning
'
,
'
warning
'
:
'
el-icon-warning
'
,
'
error
'
:
'
el-icon-
circle-cross
'
'
error
'
:
'
el-icon-
error
'
};
};
export
default
{
export
default
{
name
:
'
ElAlert
'
,
name
:
'
ElAlert
'
,
...
@@ -49,10 +49,8 @@
...
@@ -49,10 +49,8 @@
type
:
String
,
type
:
String
,
default
:
''
default
:
''
},
},
showIcon
:
{
showIcon
:
Boolean
,
type
:
Boolean
,
center
:
Boolean
default
:
false
}
},
},
data
()
{
data
()
{
...
@@ -74,7 +72,7 @@
...
@@ -74,7 +72,7 @@
},
},
iconClass
()
{
iconClass
()
{
return
TYPE_CLASSES_MAP
[
this
.
type
]
||
'
el-icon-info
rmation
'
;
return
TYPE_CLASSES_MAP
[
this
.
type
]
||
'
el-icon-info
'
;
},
},
isBigIcon
()
{
isBigIcon
()
{
...
...
packages/theme-chalk/src/alert.scss
View file @
a6016a5c
...
@@ -10,25 +10,49 @@
...
@@ -10,25 +10,49 @@
position
:
relative
;
position
:
relative
;
background-color
:
$--color-white
;
background-color
:
$--color-white
;
overflow
:
hidden
;
overflow
:
hidden
;
color
:
$--color-white
;
opacity
:
1
;
opacity
:
1
;
display
:
table
;
display
:
flex
;
align-items
:
center
;
transition
:
opacity
.2s
;
transition
:
opacity
.2s
;
@include
when
(
center
)
{
justify-content
:
center
;
}
@include
m
(
success
)
{
@include
m
(
success
)
{
background-color
:
$--alert-success-color
;
background-color
:
$--alert-success-color
;
color
:
$--color-success
;
.el-alert__description
{
color
:
$--color-success
;
}
}
}
@include
m
(
info
)
{
@include
m
(
info
)
{
background-color
:
$--alert-info-color
;
background-color
:
$--alert-info-color
;
color
:
$--color-info
;
.el-alert__description
{
color
:
$--color-info
;
}
}
}
@include
m
(
warning
)
{
@include
m
(
warning
)
{
background-color
:
$--alert-warning-color
;
background-color
:
$--alert-warning-color
;
color
:
$--color-warning
;
.el-alert__description
{
color
:
$--color-warning
;
}
}
}
@include
m
(
error
)
{
@include
m
(
error
)
{
background-color
:
$--alert-danger-color
;
background-color
:
$--alert-danger-color
;
color
:
$--color-danger
;
.el-alert__description
{
color
:
$--color-danger
;
}
}
}
@include
e
(
content
)
{
@include
e
(
content
)
{
...
@@ -39,9 +63,6 @@
...
@@ -39,9 +63,6 @@
@include
e
(
icon
)
{
@include
e
(
icon
)
{
font-size
:
$--alert-icon-size
;
font-size
:
$--alert-icon-size
;
width
:
$--alert-icon-size
;
width
:
$--alert-icon-size
;
display
:
table-cell
;
color
:
$--color-white
;
vertical-align
:
middle
;
@include
when
(
big
)
{
@include
when
(
big
)
{
font-size
:
$--alert-icon-large-size
;
font-size
:
$--alert-icon-large-size
;
width
:
$--alert-icon-large-size
;
width
:
$--alert-icon-large-size
;
...
@@ -57,14 +78,13 @@
...
@@ -57,14 +78,13 @@
}
}
&
.el-alert__description
{
&
.el-alert__description
{
color
:
$--color-white
;
font-size
:
$--alert-description-font-size
;
font-size
:
$--alert-description-font-size
;
margin
:
5px
0
0
0
;
margin
:
5px
0
0
0
;
}
}
@include
e
(
closebtn
)
{
@include
e
(
closebtn
)
{
font-size
:
$--alert-close-font-size
;
font-size
:
$--alert-close-font-size
;
color
:
$--color-
white
;
color
:
$--color-
text-placeholder
;
opacity
:
1
;
opacity
:
1
;
position
:
absolute
;
position
:
absolute
;
top
:
12px
;
top
:
12px
;
...
...
packages/theme-chalk/src/common/var.scss
View file @
a6016a5c
...
@@ -234,10 +234,10 @@ $--alert-description-font-size: 12px;
...
@@ -234,10 +234,10 @@ $--alert-description-font-size: 12px;
$--alert-close-font-size
:
12px
;
$--alert-close-font-size
:
12px
;
$--alert-close-customed-font-size
:
13px
;
$--alert-close-customed-font-size
:
13px
;
$--alert-success-color
:
$--color-success
;
$--alert-success-color
:
$--color-success
-lighter
;
$--alert-info-color
:
$--color-info
;
$--alert-info-color
:
$--color-info
-lighter
;
$--alert-warning-color
:
$--color-warning
;
$--alert-warning-color
:
$--color-warning
-lighter
;
$--alert-danger-color
:
$--color-danger
;
$--alert-danger-color
:
$--color-danger
-lighter
;
$--alert-icon-size
:
16px
;
$--alert-icon-size
:
16px
;
$--alert-icon-large-size
:
28px
;
$--alert-icon-large-size
:
28px
;
...
...
packages/theme-chalk/src/message.scss
View file @
a6016a5c
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
left
:
50%
;
left
:
50%
;
top
:
20px
;
top
:
20px
;
transform
:
translateX
(
-50%
);
transform
:
translateX
(
-50%
);
background-color
:
$--
border-color-extra-light
;
background-color
:
$--
color-info-lighter
;
transition
:
opacity
0
.3s
,
transform
.4s
;
transition
:
opacity
0
.3s
,
transform
.4s
;
overflow
:
hidden
;
overflow
:
hidden
;
padding
:
$--message-padding
;
padding
:
$--message-padding
;
...
...
test/unit/specs/alert.spec.js
View file @
a6016a5c
...
@@ -23,7 +23,6 @@ describe('Alert', () => {
...
@@ -23,7 +23,6 @@ describe('Alert', () => {
showIcon
:
true
showIcon
:
true
},
true
);
},
true
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
el-alert--success
'
)).
to
.
true
;
expect
(
vm
.
$el
.
classList
.
contains
(
'
el-alert--success
'
)).
to
.
true
;
expect
(
vm
.
$el
.
querySelector
(
'
.el-icon-circle-check
'
)).
to
.
exist
;
});
});
it
(
'
description
'
,
()
=>
{
it
(
'
description
'
,
()
=>
{
...
...
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