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
eda941e6
Commit
eda941e6
authored
Dec 28, 2016
by
Leopoldthecoder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alert: replace render function with default slot
parent
64fcb462
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
51 deletions
+6
-51
examples/docs/en-US/alert.md
examples/docs/en-US/alert.md
+1
-2
examples/docs/zh-CN/alert.md
examples/docs/zh-CN/alert.md
+1
-2
packages/alert/src/main.vue
packages/alert/src/main.vue
+4
-18
test/unit/specs/alert.spec.js
test/unit/specs/alert.spec.js
+0
-29
No files found.
examples/docs/en-US/alert.md
View file @
eda941e6
...
...
@@ -165,8 +165,7 @@ Description includes a message with more detailed information.
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
**title**
| title
**REQUIRED**
| string | — | — |
| type | component type | string | success/warning/info/error | info |
| description | supportive text | string | — | — |
| render-content | render function for content area, overrides
`description`
| function(h) | — | — |
| description | descriptive text. Can also be passed with the default slot | string | — | — |
| closable | if closable or not | boolean | — | true |
| close-text | customized close button text | string | — | — |
| show-icon | if a type icon is displayed | boolean | — | false |
...
...
examples/docs/zh-CN/alert.md
View file @
eda941e6
...
...
@@ -169,8 +169,7 @@
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
**title**
| 标题,
**必选参数**
| string | — | — |
| type | 主题 | string | success/warning/info/error | info |
| description | 辅助性文字 | string | — | — |
| render-content | 内容区域的渲染函数,会覆盖
`description`
| function(h) | — | — |
| description | 辅助性文字。也可通过默认 slot 传入 | string | — | — |
| closable | 是否可关闭 | boolean | — | true |
| close-text | 关闭按钮自定义文本 | string | — | — |
| show-icon | 是否显示图标 | boolean | — | false |
...
...
packages/alert/src/main.vue
View file @
eda941e6
...
...
@@ -4,7 +4,9 @@
<i
class=
"el-alert__icon"
:class=
"[ iconClass, isBigIcon ]"
v-if=
"showIcon"
></i>
<div
class=
"el-alert__content"
>
<span
class=
"el-alert__title"
:class=
"[ isBoldTitle ]"
v-if=
"title"
>
{{
title
}}
</span>
<desc-content></desc-content>
<slot>
<p
class=
"el-alert__description"
v-if=
"description"
>
{{
description
}}
</p>
</slot>
<i
class=
"el-alert__closebtn"
:class=
"
{ 'is-customed': closeText !== '', 'el-icon-close': closeText === '' }" v-show="closable" @click="close()">
{{
closeText
}}
</i>
</div>
</div>
...
...
@@ -45,8 +47,7 @@
showIcon
:
{
type
:
Boolean
,
default
:
false
},
renderContent
:
Function
}
},
data
()
{
...
...
@@ -55,21 +56,6 @@
};
},
components
:
{
descContent
:
{
render
(
h
)
{
const
parent
=
this
.
$parent
;
if
(
parent
.
renderContent
)
{
return
parent
.
renderContent
(
h
);
}
else
if
(
parent
.
description
)
{
return
<
p
class
=
"
el-alert__description
"
>
{
parent
.
description
}
<
/p>
;
}
else
{
return
''
;
}
}
}
},
methods
:
{
close
()
{
this
.
visible
=
false
;
...
...
test/unit/specs/alert.spec.js
View file @
eda941e6
...
...
@@ -36,35 +36,6 @@ describe('Alert', () => {
.
to
.
equal
(
'
Unbowed, Unbent, Unbroken
'
);
});
it
(
'
render-content
'
,
()
=>
{
vm
=
createVue
({
data
()
{
return
{
text
:
'
test
'
};
},
template
:
`
<div>
<el-alert
title="test"
:render-content="customContent"></el-alert>
</div>
`
,
methods
:
{
customContent
(
h
)
{
return
(
<
p
>
<
el
-
button
class
=
"
custom-button
"
>
{
this
.
text
}
<
/el-button
>
<
/p
>
);
}
}
},
true
);
let
button
=
vm
.
$el
.
querySelector
(
'
.custom-button
'
);
expect
(
button
).
to
.
exist
;
expect
(
button
.
textContent
).
to
.
equal
(
'
test
'
);
});
it
(
'
close
'
,
()
=>
{
vm
=
createVue
({
template
:
`
...
...
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