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
fff4d625
Commit
fff4d625
authored
Sep 20, 2018
by
morning
Committed by
GitHub
Sep 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dialog: add opened event (#12828)
* Dialog: add opened event * Docs: update es dialog doc * Update dialog.md
parent
098ba463
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
4 deletions
+24
-4
examples/docs/en-US/dialog.md
examples/docs/en-US/dialog.md
+1
-0
examples/docs/es/dialog.md
examples/docs/es/dialog.md
+1
-0
examples/docs/zh-CN/dialog.md
examples/docs/zh-CN/dialog.md
+1
-0
packages/dialog/src/component.vue
packages/dialog/src/component.vue
+4
-0
test/unit/specs/dialog.spec.js
test/unit/specs/dialog.spec.js
+17
-4
No files found.
examples/docs/en-US/dialog.md
View file @
fff4d625
...
...
@@ -309,5 +309,6 @@ If the variable bound to `visible` is managed in Vuex store, the `.sync` can not
| Event Name | Description | Parameters |
|---------- |-------- |---------- |
| open | triggers when the Dialog opens | — |
| opened | triggers when the Dialog opening animation ends | — |
| close | triggers when the Dialog closes | — |
| closed | triggers when the Dialog closing animation ends | — |
examples/docs/es/dialog.md
View file @
fff4d625
...
...
@@ -317,6 +317,7 @@ Si la variable ligada a `visible` se gestiona en el Vuex store, el `.sync` no pu
| Nombre de Evento | Descripcíon | Parámetros |
| ---------------- | ---------------------------------------- | ---------- |
| open | se activa cuando se abre el cuadro de Diálogo | — |
| opened | triggers when the Dialog opening animation ends | — |
| close | se dispara cuando el Diálogo se cierra | — |
| closed | se activa cuando finaliza la animación de cierre del Diálog | — |
examples/docs/zh-CN/dialog.md
View file @
fff4d625
...
...
@@ -305,5 +305,6 @@ Dialog 的内容是懒渲染的,即在第一次被打开之前,传入的默
| 事件名称 | 说明 | 回调参数 |
|---------- |-------- |---------- |
| open | Dialog 打开的回调 | — |
| opened | Dialog 打开动画结束时的回调 | — |
| close | Dialog 关闭的回调 | — |
| closed | Dialog 关闭动画结束时的回调 | — |
packages/dialog/src/component.vue
View file @
fff4d625
<
template
>
<transition
name=
"dialog-fade"
@
after-enter=
"afterEnter"
@
after-leave=
"afterLeave"
>
<div
class=
"el-dialog__wrapper"
v-show=
"visible"
@
click.self=
"handleWrapperClick"
>
<div
...
...
@@ -169,6 +170,9 @@
this
.
broadcast
(
'
ElSelectDropdown
'
,
'
updatePopper
'
);
this
.
broadcast
(
'
ElDropdownMenu
'
,
'
updatePopper
'
);
},
afterEnter
()
{
this
.
$emit
(
'
opened
'
);
},
afterLeave
()
{
this
.
$emit
(
'
closed
'
);
}
...
...
test/unit/specs/dialog.spec.js
View file @
fff4d625
...
...
@@ -157,7 +157,9 @@ describe('Dialog', () => {
<div>
<el-dialog
@open="handleOpen"
@opened="handleOpened"
@close="handleClose"
@closed="handleClosed"
:title="title"
:visible.sync="visible">
<span>这是一段信息</span>
...
...
@@ -170,14 +172,23 @@ describe('Dialog', () => {
this
.
state
=
'
open
'
;
},
handleOpened
()
{
this
.
animationState
=
'
opened
'
;
},
handleClose
()
{
this
.
state
=
'
closed
'
;
this
.
state
=
'
close
'
;
},
handleClosed
()
{
this
.
animationState
=
'
closed
'
;
}
},
data
()
{
return
{
state
:
''
,
animationState
:
''
,
title
:
'
dialog test
'
,
visible
:
false
};
...
...
@@ -186,12 +197,14 @@ describe('Dialog', () => {
vm
.
visible
=
true
;
setTimeout
(()
=>
{
expect
(
vm
.
state
).
to
.
equal
(
'
open
'
);
expect
(
vm
.
animationState
).
to
.
equal
(
'
opened
'
);
vm
.
visible
=
false
;
setTimeout
(()
=>
{
expect
(
vm
.
state
).
to
.
equal
(
'
closed
'
);
expect
(
vm
.
state
).
to
.
equal
(
'
close
'
);
expect
(
vm
.
animationState
).
to
.
equal
(
'
closed
'
);
done
();
},
5
0
);
},
5
0
);
},
40
0
);
},
40
0
);
});
it
(
'
click dialog to close
'
,
done
=>
{
vm
=
createVue
({
...
...
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