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
09e789ba
Commit
09e789ba
authored
Jul 21, 2021
by
好多大米
Committed by
GitHub
Jul 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Result: add result component (#21171)
parent
6bbc0465
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
692 additions
and
11 deletions
+692
-11
components.json
components.json
+2
-1
examples/docs/en-US/result.md
examples/docs/en-US/result.md
+76
-0
examples/docs/es/result.md
examples/docs/es/result.md
+76
-0
examples/docs/fr-FR/result.md
examples/docs/fr-FR/result.md
+76
-0
examples/docs/zh-CN/result.md
examples/docs/zh-CN/result.md
+76
-0
examples/nav.config.json
examples/nav.config.json
+16
-0
packages/result/index.js
packages/result/index.js
+8
-0
packages/result/src/icon-error.vue
packages/result/src/icon-error.vue
+13
-0
packages/result/src/icon-info.vue
packages/result/src/icon-info.vue
+13
-0
packages/result/src/icon-success.vue
packages/result/src/icon-success.vue
+13
-0
packages/result/src/icon-warning.vue
packages/result/src/icon-warning.vue
+13
-0
packages/result/src/index.vue
packages/result/src/index.vue
+65
-0
packages/skeleton/src/index.vue
packages/skeleton/src/index.vue
+1
-1
packages/theme-chalk/src/common/var.scss
packages/theme-chalk/src/common/var.scss
+13
-0
packages/theme-chalk/src/index.scss
packages/theme-chalk/src/index.scss
+1
-0
packages/theme-chalk/src/result.scss
packages/theme-chalk/src/result.scss
+61
-0
src/index.js
src/index.js
+4
-1
test/unit/specs/descriptions.spec.js
test/unit/specs/descriptions.spec.js
+7
-7
test/unit/specs/result.spec.js
test/unit/specs/result.spec.js
+120
-0
types/element-ui.d.ts
types/element-ui.d.ts
+5
-1
types/result.d.ts
types/result.d.ts
+33
-0
No files found.
components.json
View file @
09e789ba
...
@@ -85,5 +85,6 @@
...
@@ -85,5 +85,6 @@
"skeleton-item"
:
"./packages/skeleton-item/index.js"
,
"skeleton-item"
:
"./packages/skeleton-item/index.js"
,
"empty"
:
"./packages/empty/index.js"
,
"empty"
:
"./packages/empty/index.js"
,
"descriptions"
:
"./packages/descriptions/index.js"
,
"descriptions"
:
"./packages/descriptions/index.js"
,
"descriptions-item"
:
"./packages/descriptions-item/index.js"
"descriptions-item"
:
"./packages/descriptions-item/index.js"
,
"result"
:
"./packages/result/index.js"
}
}
examples/docs/en-US/result.md
0 → 100644
View file @
09e789ba
## Result
Used to give feedback on the result of user's operation or access exception.
### Basic usage
:::demo
```
html
<el-row>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"success"
title=
"Success Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"warning"
title=
"Warning Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"error"
title=
"Error Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"info"
title=
"Info Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
</el-row>
```
:::
### Customized content
:::demo
```
html
<el-result
title=
"404"
subTitle=
"Sorry, request error"
>
<template
slot=
"icon"
>
<el-image
src=
"https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
></el-image>
</template>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
```
:::
### Result Attributes
| Attribute | Description | Type | Accepted Values | Default |
|------------- |---------------- |---------------- |---------------------- |-------- |
| title | title | string | — | — |
| sub-title | sub title | string | — | — |
| icon | icon type | string | success / warning / info / error | info |
### Result Slots
| Name | Description |
|------|--------|
| icon | custom icon |
| title | custom title |
| subTitle | custom sub title |
| extra | custom extra area |
examples/docs/es/result.md
0 → 100644
View file @
09e789ba
## Result
Used to give feedback on the result of user's operation or access exception.
### Basic usage
:::demo
```
html
<el-row>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"success"
title=
"Success Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"warning"
title=
"Warning Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"error"
title=
"Error Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"info"
title=
"Info Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
</el-row>
```
:::
### Customized content
:::demo
```
html
<el-result
title=
"404"
subTitle=
"Sorry, request error"
>
<template
slot=
"icon"
>
<el-image
src=
"https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
></el-image>
</template>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
```
:::
### Result Attributes
| Attribute | Description | Type | Accepted Values | Default |
|------------- |---------------- |---------------- |---------------------- |-------- |
| title | title | string | — | — |
| sub-title | sub title | string | — | — |
| icon | icon type | string | success / warning / info / error | info |
### Result Slots
| Name | Description |
|------|--------|
| icon | custom icon |
| title | custom title |
| subTitle | custom sub title |
| extra | custom extra area |
examples/docs/fr-FR/result.md
0 → 100644
View file @
09e789ba
## Result
Used to give feedback on the result of user's operation or access exception.
### Basic usage
:::demo
```
html
<el-row>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"success"
title=
"Success Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"warning"
title=
"Warning Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"error"
title=
"Error Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"info"
title=
"Info Tip"
subTitle=
"Please follow the instructions"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
</el-col>
</el-row>
```
:::
### Customized content
:::demo
```
html
<el-result
title=
"404"
subTitle=
"Sorry, request error"
>
<template
slot=
"icon"
>
<el-image
src=
"https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
></el-image>
</template>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
Back
</el-button>
</template>
</el-result>
```
:::
### Result Attributes
| Attribute | Description | Type | Accepted Values | Default |
|------------- |---------------- |---------------- |---------------------- |-------- |
| title | title | string | — | — |
| sub-title | sub title | string | — | — |
| icon | icon type | string | success / warning / info / error | info |
### Result Slots
| Name | Description |
|------|--------|
| icon | custom icon |
| title | custom title |
| subTitle | custom sub title |
| extra | custom extra area |
examples/docs/zh-CN/result.md
0 → 100644
View file @
09e789ba
## Result 结果
用于对用户的操作结果或者异常状态做反馈。
### 基础用法
:::demo
```
html
<el-row>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"success"
title=
"成功提示"
subTitle=
"请根据提示进行操作"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
返回
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"warning"
title=
"警告提示"
subTitle=
"请根据提示进行操作"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
返回
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"error"
title=
"错误提示"
subTitle=
"请根据提示进行操作"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
返回
</el-button>
</template>
</el-result>
</el-col>
<el-col
:sm=
"12"
:lg=
"6"
>
<el-result
icon=
"info"
title=
"信息提示"
subTitle=
"请根据提示进行操作"
>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
返回
</el-button>
</template>
</el-result>
</el-col>
</el-row>
```
:::
### 自定义内容
:::demo
```
html
<el-result
title=
"404"
subTitle=
"抱歉,请求错误"
>
<template
slot=
"icon"
>
<el-image
src=
"https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png"
></el-image>
</template>
<template
slot=
"extra"
>
<el-button
type=
"primary"
size=
"medium"
>
返回
</el-button>
</template>
</el-result>
```
:::
### Result Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------------- |---------------- |---------------- |---------------------- |-------- |
| title | 标题 | string | — | — |
| sub-title | 二级标题 | string | — | — |
| icon | 图标类型 | string | success / warning / info / error | info |
### Result Slots
| Name | 说明 |
|------|--------|
| icon | 自定义图标 |
| title | 自定义标题 |
| subTitle | 自定义二级标题 |
| extra | 自定义底部额外区域 |
examples/nav.config.json
View file @
09e789ba
...
@@ -188,6 +188,10 @@
...
@@ -188,6 +188,10 @@
{
{
"path"
:
"/descriptions"
,
"path"
:
"/descriptions"
,
"title"
:
"Descriptions 描述列表"
"title"
:
"Descriptions 描述列表"
},
{
"path"
:
"/result"
,
"title"
:
"Result 结果"
}
}
]
]
},
},
...
@@ -494,6 +498,10 @@
...
@@ -494,6 +498,10 @@
{
{
"path"
:
"/descriptions"
,
"path"
:
"/descriptions"
,
"title"
:
"Descriptions"
"title"
:
"Descriptions"
},
{
"path"
:
"/result"
,
"title"
:
"Result"
}
}
]
]
},
},
...
@@ -804,6 +812,10 @@
...
@@ -804,6 +812,10 @@
{
{
"path"
:
"/descriptions"
,
"path"
:
"/descriptions"
,
"title"
:
"Descriptions"
"title"
:
"Descriptions"
},
{
"path"
:
"/result"
,
"title"
:
"Result"
}
}
]
]
},
},
...
@@ -1114,6 +1126,10 @@
...
@@ -1114,6 +1126,10 @@
{
{
"path"
:
"/descriptions"
,
"path"
:
"/descriptions"
,
"title"
:
"Descriptions"
"title"
:
"Descriptions"
},
{
"path"
:
"/result"
,
"title"
:
"Result"
}
}
]
]
},
},
...
...
packages/result/index.js
0 → 100644
View file @
09e789ba
import
Result
from
'
./src/index.vue
'
;
/* istanbul ignore next */
Result
.
install
=
function
(
Vue
)
{
Vue
.
component
(
Result
.
name
,
Result
);
};
export
default
Result
;
packages/result/src/icon-error.vue
0 → 100644
View file @
09e789ba
<
template
>
<svg
viewBox=
"0 0 48 48"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M32.57818,15.42182 C32.0157534,14.8593933 31.1038797,14.8593933 30.541453,15.42182 L30.541453,15.42182 L24.0006789,21.9625941 L17.458547,15.42182 C16.8961203,14.8593933 15.9842466,14.8593933 15.42182,15.42182 C14.8593933,15.9842466 14.8593933,16.8961203 15.42182,17.458547 L15.42182,17.458547 L21.9639519,23.9993211 L15.42182,30.541453 C14.8593933,31.1038797 14.8593933,32.0157534 15.42182,32.57818 C15.9842466,33.1406067 16.8961203,33.1406067 17.458547,32.57818 L17.458547,32.57818 L24.0006789,26.0360481 L30.541453,32.57818 C31.1038797,33.1406067 32.0157534,33.1406067 32.57818,32.57818 C33.1406067,32.0157534 33.1406067,31.1038797 32.57818,30.541453 L32.57818,30.541453 L26.0374059,23.9993211 L32.57818,17.458547 C33.1406067,16.8961203 33.1406067,15.9842466 32.57818,15.42182 Z"
/>
</svg>
</
template
>
<
script
>
export
default
{
name
:
'
IconError
'
};
</
script
>
packages/result/src/icon-info.vue
0 → 100644
View file @
09e789ba
<
template
>
<svg
viewBox=
"0 0 48 48"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M24,19 L21,19 C20.1715729,19 19.5,19.6715729 19.5,20.5 C19.5,21.3284271 20.1715729,22 21,22 L21,22 L22.5,22 L22.5,31 L21,31 C20.1715729,31 19.5,31.6715729 19.5,32.5 C19.5,33.3284271 20.1715729,34 21,34 L21,34 L27,34 C27.8284271,34 28.5,33.3284271 28.5,32.5 C28.5,31.6715729 27.8284271,31 27,31 L27,31 L25.5,31 L25.5,20.5 C25.5,19.6715729 24.8284271,19 24,19 L24,19 Z M24,13 C22.8954305,13 22,13.8954305 22,15 C22,16.1045695 22.8954305,17 24,17 C25.1045695,17 26,16.1045695 26,15 C26,13.8954305 25.1045695,13 24,13 Z"
/>
</svg>
</
template
>
<
script
lang=
"ts"
>
export
default
{
name
:
'
IconInfo
'
};
</
script
>
packages/result/src/icon-success.vue
0 → 100644
View file @
09e789ba
<
template
>
<svg
viewBox=
"0 0 48 48"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M34.5548098,16.4485711 C33.9612228,15.8504763 32.9988282,15.8504763 32.4052412,16.4485711 L32.4052412,16.4485711 L21.413757,27.5805811 L21.413757,27.5805811 L21.4034642,27.590855 C21.0097542,27.9781674 20.3766105,27.9729811 19.9892981,27.5792711 L19.9892981,27.5792711 L15.5947588,23.1121428 C15.0011718,22.514048 14.0387772,22.514048 13.4451902,23.1121428 C12.8516033,23.7102376 12.8516033,24.6799409 13.4451902,25.2780357 L13.4451902,25.2780357 L19.6260786,31.5514289 C20.2196656,32.1495237 21.1820602,32.1495237 21.7756472,31.5514289 L21.7756472,31.5514289 L34.5548098,18.614464 C35.1483967,18.0163692 35.1483967,17.0466659 34.5548098,16.4485711 Z"
/>
</svg>
</
template
>
<
script
>
export
default
{
name
:
'
IconSuccess
'
};
</
script
>
packages/result/src/icon-warning.vue
0 → 100644
View file @
09e789ba
<
template
>
<svg
viewBox=
"0 0 48 48"
xmlns=
"http://www.w3.org/2000/svg"
>
<path
d=
"M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M24,31 C22.8954305,31 22,31.8954305 22,33 C22,34.1045695 22.8954305,35 24,35 C25.1045695,35 26,34.1045695 26,33 C26,31.8954305 25.1045695,31 24,31 Z M24,14 C23.1715729,14 22.5,14.6715729 22.5,15.5 L22.5,15.5 L22.5,27.5 C22.5,28.3284271 23.1715729,29 24,29 C24.8284271,29 25.5,28.3284271 25.5,27.5 L25.5,27.5 L25.5,15.5 C25.5,14.6715729 24.8284271,14 24,14 Z"
/>
</svg>
</
template
>
<
script
lang=
"ts"
>
export
default
{
name
:
'
IconWarning
'
};
</
script
>
packages/result/src/index.vue
0 → 100644
View file @
09e789ba
<
template
>
<div
class=
"el-result"
>
<div
class=
"el-result__icon"
>
<slot
name=
"icon"
>
<component
:is=
"iconElement"
:class=
"iconElement"
/>
</slot>
</div>
<div
v-if=
"title || $slots.title"
class=
"el-result__title"
>
<slot
name=
"title"
>
<p>
{{
title
}}
</p>
</slot>
</div>
<div
v-if=
"subTitle || $slots.subTitle"
class=
"el-result__subtitle"
>
<slot
name=
"subTitle"
>
<p>
{{
subTitle
}}
</p>
</slot>
</div>
<div
v-if=
"$slots.extra"
class=
"el-result__extra"
>
<slot
name=
"extra"
></slot>
</div>
</div>
</
template
>
<
script
>
import
IconSuccess
from
'
./icon-success.vue
'
;
import
IconError
from
'
./icon-error.vue
'
;
import
IconWarning
from
'
./icon-warning.vue
'
;
import
IconInfo
from
'
./icon-info.vue
'
;
const
IconMap
=
{
success
:
'
icon-success
'
,
warning
:
'
icon-warning
'
,
error
:
'
icon-error
'
,
info
:
'
icon-info
'
};
export
default
{
name
:
'
ElResult
'
,
components
:
{
[
IconSuccess
.
name
]:
IconSuccess
,
[
IconError
.
name
]:
IconError
,
[
IconWarning
.
name
]:
IconWarning
,
[
IconInfo
.
name
]:
IconInfo
},
props
:
{
title
:
{
type
:
String
,
default
:
''
},
subTitle
:
{
type
:
String
,
default
:
''
},
icon
:
{
type
:
String
,
default
:
'
info
'
}
},
computed
:
{
iconElement
()
{
const
icon
=
this
.
icon
;
return
icon
&&
IconMap
[
icon
]
?
IconMap
[
icon
]
:
'
icon-info
'
;
}
}
};
</
script
>
packages/skeleton/src/index.vue
View file @
09e789ba
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<slot
v-if=
"loading"
name=
"template"
>
<slot
v-if=
"loading"
name=
"template"
>
<el-skeleton-item
<el-skeleton-item
v-for=
"item in rows"
v-for=
"item in rows"
:key=
"
item
"
:key=
"
`$
{i}-${item}`
"
:class="{
:class="{
'el-skeleton__paragraph': item !== 1,
'el-skeleton__paragraph': item !== 1,
'is-first': item === 1,
'is-first': item === 1,
...
...
packages/theme-chalk/src/common/var.scss
View file @
09e789ba
...
@@ -987,6 +987,19 @@ $--skeleton-to-color: #e6e6e6 !default;
...
@@ -987,6 +987,19 @@ $--skeleton-to-color: #e6e6e6 !default;
--------------- */
--------------- */
$--svg-monochrome-grey
:
#DCDDE0
!
default
;
$--svg-monochrome-grey
:
#DCDDE0
!
default
;
/* Result
-------------------------- */
$--result-padding
:
40px
30px
!
default
;
$--result-icon-font-size
:
64px
!
default
;
$--result-title-font-size
:
20px
!
default
;
$--result-title-margin-top
:
20px
!
default
;
$--result-subtitle-margin-top
:
10px
!
default
;
$--result-extra-margin-top
:
30px
!
default
;
$--result-info-color
:
$--color-info
!
default
;
$--result-success-color
:
$--color-success
!
default
;
$--result-warning-color
:
$--color-warning
!
default
;
$--result-danger-color
:
$--color-danger
!
default
;
/* Break-point
/* Break-point
--------------------------*/
--------------------------*/
$--sm
:
768px
!
default
;
$--sm
:
768px
!
default
;
...
...
packages/theme-chalk/src/index.scss
View file @
09e789ba
...
@@ -83,3 +83,4 @@
...
@@ -83,3 +83,4 @@
@import
"./empty.scss"
;
@import
"./empty.scss"
;
@import
"./descriptions.scss"
;
@import
"./descriptions.scss"
;
@import
"./descriptions-item.scss"
;
@import
"./descriptions-item.scss"
;
@import
"./result.scss"
;
packages/theme-chalk/src/result.scss
0 → 100644
View file @
09e789ba
@import
'mixins/mixins'
;
@import
'common/var'
;
@include
b
(
result
)
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
flex-direction
:
column
;
text-align
:
center
;
box-sizing
:
border-box
;
padding
:
$--result-padding
;
@include
e
(
icon
)
{
svg
{
width
:
$--result-icon-font-size
;
height
:
$--result-icon-font-size
;
}
}
@include
e
(
title
)
{
margin-top
:
$--result-title-margin-top
;
p
{
margin
:
0
;
font-size
:
$--result-title-font-size
;
color
:
$--color-text-primary
;
line-height
:
1
.3
;
}
}
@include
e
(
subtitle
)
{
margin-top
:
$--result-subtitle-margin-top
;
p
{
margin
:
0
;
font-size
:
$--font-size-base
;
color
:
$--color-text-regular
;
line-height
:
1
.3
;
}
}
@include
e
(
extra
)
{
margin-top
:
$--result-extra-margin-top
;
}
.icon-success
{
fill
:
$--result-success-color
;
}
.icon-error
{
fill
:
$--result-danger-color
;
}
.icon-info
{
fill
:
$--result-info-color
;
}
.icon-warning
{
fill
:
$--result-warning-color
;
}
}
src/index.js
View file @
09e789ba
...
@@ -87,6 +87,7 @@ import SkeletonItem from '../packages/skeleton-item/index.js';
...
@@ -87,6 +87,7 @@ import SkeletonItem from '../packages/skeleton-item/index.js';
import
Empty
from
'
../packages/empty/index.js
'
;
import
Empty
from
'
../packages/empty/index.js
'
;
import
Descriptions
from
'
../packages/descriptions/index.js
'
;
import
Descriptions
from
'
../packages/descriptions/index.js
'
;
import
DescriptionsItem
from
'
../packages/descriptions-item/index.js
'
;
import
DescriptionsItem
from
'
../packages/descriptions-item/index.js
'
;
import
Result
from
'
../packages/result/index.js
'
;
import
locale
from
'
element-ui/src/locale
'
;
import
locale
from
'
element-ui/src/locale
'
;
import
CollapseTransition
from
'
element-ui/src/transitions/collapse-transition
'
;
import
CollapseTransition
from
'
element-ui/src/transitions/collapse-transition
'
;
...
@@ -173,6 +174,7 @@ const components = [
...
@@ -173,6 +174,7 @@ const components = [
Empty
,
Empty
,
Descriptions
,
Descriptions
,
DescriptionsItem
,
DescriptionsItem
,
Result
,
CollapseTransition
CollapseTransition
];
];
...
@@ -299,5 +301,6 @@ export default {
...
@@ -299,5 +301,6 @@ export default {
SkeletonItem
,
SkeletonItem
,
Empty
,
Empty
,
Descriptions
,
Descriptions
,
DescriptionsItem
DescriptionsItem
,
Result
};
};
test/unit/specs/descriptions.spec.js
View file @
09e789ba
...
@@ -12,7 +12,7 @@ describe('Descriptions', () => {
...
@@ -12,7 +12,7 @@ describe('Descriptions', () => {
{
{
template
:
`
template
:
`
<el-descriptions title="title" extra="extra">
<el-descriptions title="title" extra="extra">
<el-descriptions-item v-for="item in 4"></el-descriptions-item>
<el-descriptions-item v-for="item in 4"
:key="item"
></el-descriptions-item>
</el-descriptions>
</el-descriptions>
`
`
},
},
...
@@ -29,8 +29,8 @@ describe('Descriptions', () => {
...
@@ -29,8 +29,8 @@ describe('Descriptions', () => {
{
{
template
:
`
template
:
`
<el-descriptions border>
<el-descriptions border>
<el-descriptions-item v-for="item in 3" :label="item">{{ item }}</el-descriptions-item>
<el-descriptions-item v-for="item in 3" :label="item"
:key="item"
>{{ item }}</el-descriptions-item>
</el-descriptions
</el-descriptions
>
`
`
},
},
true
true
...
@@ -44,7 +44,7 @@ describe('Descriptions', () => {
...
@@ -44,7 +44,7 @@ describe('Descriptions', () => {
{
{
template
:
`
template
:
`
<el-descriptions border label-class-name="label-class-name" content-class-name="content-class-name">
<el-descriptions border label-class-name="label-class-name" content-class-name="content-class-name">
<el-descriptions-item v-for="item in 3" :label="item">{{ item }}</el-descriptions-item>
<el-descriptions-item v-for="item in 3" :label="item"
:key="item"
>{{ item }}</el-descriptions-item>
</el-descriptions>
</el-descriptions>
`
`
},
},
...
@@ -58,7 +58,7 @@ describe('Descriptions', () => {
...
@@ -58,7 +58,7 @@ describe('Descriptions', () => {
vm
=
createVue
({
vm
=
createVue
({
template
:
`
template
:
`
<el-descriptions :column="5" :border="border">
<el-descriptions :column="5" :border="border">
<el-descriptions-item v-for="item in 10" :label="item">{{ item }}</el-descriptions-item>
<el-descriptions-item v-for="item in 10" :label="item"
:key="item"
>{{ item }}</el-descriptions-item>
</el-descriptions>
</el-descriptions>
`
,
`
,
data
()
{
data
()
{
...
@@ -79,7 +79,7 @@ describe('Descriptions', () => {
...
@@ -79,7 +79,7 @@ describe('Descriptions', () => {
template
:
`
template
:
`
<el-descriptions :column="5" :direction="direction" border>
<el-descriptions :column="5" :direction="direction" border>
<el-descriptions-item v-for="item in 10" :label="item">{{ item }}</el-descriptions-item>
<el-descriptions-item v-for="item in 10" :label="item"
:key="item"
>{{ item }}</el-descriptions-item>
</el-descriptions>
</el-descriptions>
`
,
`
,
data
()
{
data
()
{
...
@@ -102,7 +102,7 @@ describe('Descriptions', () => {
...
@@ -102,7 +102,7 @@ describe('Descriptions', () => {
template
:
`
template
:
`
<el-descriptions>
<el-descriptions>
<template slot="title">title</template>
<template slot="title">title</template>
<el-descriptions-item v-for="item in 10" :label="item">{{ item }}</el-descriptions-item>
<el-descriptions-item v-for="item in 10" :label="item"
:key="item"
>{{ item }}</el-descriptions-item>
</el-descriptions>
</el-descriptions>
`
`
},
true
);
},
true
);
...
...
test/unit/specs/result.spec.js
0 → 100644
View file @
09e789ba
import
{
createVue
,
destroyVM
,
waitImmediate
}
from
'
../util
'
;
const
AXIOM
=
'
Rem is the best girl
'
;
describe
(
'
Result
'
,
()
=>
{
let
vm
;
afterEach
(()
=>
{
destroyVM
(
vm
);
});
it
(
'
render test
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result />
'
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon
'
)).
to
.
exist
;
expect
(
Array
.
from
(
vm
.
$el
.
classList
)).
to
.
contain
(
'
el-result
'
);
});
it
(
'
should render title props
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result :title="title"/>
'
,
data
()
{
return
{
title
:
AXIOM
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__title
'
).
innerText
).
to
.
be
.
equal
(
AXIOM
);
});
it
(
'
should render sub-title props
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result :sub-title="subTitle"/>
'
,
data
()
{
return
{
subTitle
:
AXIOM
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__subtitle
'
).
innerText
).
to
.
be
.
equal
(
AXIOM
);
});
it
(
'
should render icon props
'
,
async
()
=>
{
vm
=
createVue
({
template
:
'
<el-result :icon="icon"/>
'
,
data
()
{
return
{
icon
:
'
success
'
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
)).
to
.
exist
;
expect
(
Array
.
from
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
).
classList
)).
to
.
contain
(
'
icon-success
'
);
vm
.
icon
=
'
error
'
;
await
waitImmediate
();
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
)).
to
.
exist
;
expect
(
Array
.
from
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
).
classList
)).
to
.
contain
(
'
icon-error
'
);
vm
.
icon
=
'
warning
'
;
await
waitImmediate
();
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
)).
to
.
exist
;
expect
(
Array
.
from
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
).
classList
)).
to
.
contain
(
'
icon-warning
'
);
vm
.
icon
=
'
info
'
;
await
waitImmediate
();
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
)).
to
.
exist
;
expect
(
Array
.
from
(
vm
.
$el
.
querySelector
(
'
.el-result__icon svg
'
).
classList
)).
to
.
contain
(
'
icon-info
'
);
});
it
(
'
should render icon slots
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result><template slot="icon">{{icon}}</template></el-result>
'
,
data
()
{
return
{
icon
:
AXIOM
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon
'
)).
to
.
exist
;
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__icon
'
).
innerText
).
to
.
be
.
equal
(
AXIOM
);
});
it
(
'
should render title slots
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result><template slot="title">{{title}}</template></el-result>
'
,
data
()
{
return
{
title
:
AXIOM
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__title
'
)).
to
.
exist
;
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__title
'
).
innerText
).
to
.
be
.
equal
(
AXIOM
);
});
it
(
'
should render sub-title slots
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result><template slot="subTitle">{{subTitle}}</template></el-result>
'
,
data
()
{
return
{
subTitle
:
AXIOM
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__subtitle
'
)).
to
.
exist
;
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__subtitle
'
).
innerText
).
to
.
be
.
equal
(
AXIOM
);
});
it
(
'
should render extra slots
'
,
()
=>
{
vm
=
createVue
({
template
:
'
<el-result><template slot="extra">{{extra}}</template></el-result>
'
,
data
()
{
return
{
extra
:
AXIOM
};
}
},
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__extra
'
)).
to
.
exist
;
expect
(
vm
.
$el
.
querySelector
(
'
.el-result__extra
'
).
innerText
).
to
.
be
.
equal
(
AXIOM
);
});
});
types/element-ui.d.ts
View file @
09e789ba
...
@@ -87,6 +87,7 @@ import { ElEmpty } from './empty'
...
@@ -87,6 +87,7 @@ import { ElEmpty } from './empty'
import
{
ElSpinner
}
from
'
./spinner
'
import
{
ElSpinner
}
from
'
./spinner
'
import
{
ElDescriptions
}
from
'
./descriptions
'
import
{
ElDescriptions
}
from
'
./descriptions
'
import
{
ElDescriptionsItem
}
from
'
./descriptions-item
'
import
{
ElDescriptionsItem
}
from
'
./descriptions-item
'
import
{
ElResult
}
from
'
./result
'
export
interface
InstallationOptions
{
export
interface
InstallationOptions
{
locale
:
any
,
locale
:
any
,
...
@@ -371,4 +372,7 @@ export class Spinner extends ElSpinner {}
...
@@ -371,4 +372,7 @@ export class Spinner extends ElSpinner {}
export
class
Descripitions
extends
ElDescriptions
{}
export
class
Descripitions
extends
ElDescriptions
{}
/** Description Item Component */
/** Description Item Component */
export
class
DescripitionsItem
extends
ElDescriptionsItem
{}
export
class
DescripitionsItem
extends
ElDescriptionsItem
{}
\ No newline at end of file
/** Result Component */
export
class
Result
extends
ElResult
{}
\ No newline at end of file
types/result.d.ts
0 → 100644
View file @
09e789ba
import
{
ElementUIComponent
}
from
'
./component
'
import
{
VNode
}
from
'
vue
'
interface
ElResultSlots
{
/* title slot: custom title */
title
:
VNode
[]
/* icon slot: custom icon */
icon
:
VNode
[]
/* subTitle slot: custom sub title */
subTitle
:
VNode
[]
/* extra slot: custom extra area, display on the top right */
extra
:
VNode
[]
[
key
:
string
]:
VNode
[]
}
/** Used to give feedback on the result of user's operation or access exception. **/
export
declare
class
ElResult
extends
ElementUIComponent
{
/* title */
title
:
string
/* sub title */
subTitle
:
string
/* icon type */
icon
:
'
success
'
|
'
warning
'
|
'
info
'
|
'
error
'
$slots
:
ElResultSlots
}
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