File tree Expand file tree Collapse file tree 4 files changed +26
-12
lines changed
examples/sites/demos/pc/app/modal Expand file tree Collapse file tree 4 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,13 @@ function showModal() {
13
13
status: ' info' ,
14
14
messageClosable: true ,
15
15
events: {
16
+ hide : () => {
17
+ Notify ({
18
+ type: ' info' ,
19
+ title: ' 触发hide回调事件' ,
20
+ position: ' top-right'
21
+ })
22
+ },
16
23
close : () => {
17
24
Notify ({
18
25
type: ' info' ,
Original file line number Diff line number Diff line change 5
5
</template >
6
6
7
7
<script >
8
- import { Button , Modal } from ' @opentiny/vue'
8
+ import { Button , Modal , Notify } from ' @opentiny/vue'
9
9
10
10
export default {
11
11
components: {
@@ -18,6 +18,13 @@ export default {
18
18
status: ' info' ,
19
19
messageClosable: true ,
20
20
events: {
21
+ hide : () => {
22
+ Notify ({
23
+ type: ' info' ,
24
+ title: ' 触发hide回调事件' ,
25
+ position: ' top-right'
26
+ })
27
+ },
21
28
close : () => {
22
29
Notify ({
23
30
type: ' info' ,
Original file line number Diff line number Diff line change @@ -370,13 +370,13 @@ export const close =
370
370
state . contentVisible = false
371
371
setTimeout ( ( ) => {
372
372
state . visible = false
373
-
374
373
let params = { type, $modal : parent }
375
- if ( events . close ) {
376
- events . close . call ( parent , params )
374
+ emit ( 'close' , params )
375
+ if ( events . hide ) {
376
+ events . hide . call ( parent , params )
377
377
} else {
378
378
emit ( 'update:modelValue' , false )
379
- emit ( 'close ' , params )
379
+ emit ( 'hide ' , params )
380
380
}
381
381
} , 200 )
382
382
}
Original file line number Diff line number Diff line change @@ -31,18 +31,18 @@ export function Modal(options) {
31
31
let events = options . events || { }
32
32
let $modal
33
33
options . events = Object . assign ( { } , events , {
34
+ hide ( params ) {
35
+ events . hide && events . hide . call ( this , params )
36
+ if ( $modal . beforeUnmouted ) {
37
+ $modal . beforeUnmouted ( )
38
+ }
39
+ resolve ( params . type )
40
+ } ,
34
41
confirm ( params ) {
35
42
events . confirm && events . confirm . call ( this , params )
36
43
} ,
37
44
show ( params ) {
38
45
events . show && events . show . call ( this , params )
39
- } ,
40
- close ( params ) {
41
- events . close && events . close . call ( this , params )
42
- if ( $modal . beforeUnmouted ) {
43
- $modal . beforeUnmouted ( )
44
- }
45
- resolve ( params . type )
46
46
}
47
47
} )
48
48
You can’t perform that action at this time.
0 commit comments