File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/vue-final-modal/src Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -78,19 +78,23 @@ export function useModal<P = InstanceType<typeof VueFinalModal>['$props']>(_opti
78
78
options . context ?. dynamicModals . push ( options )
79
79
80
80
function open ( ) : Promise < string > {
81
+ if ( ! options ?. context )
82
+ return Promise . resolve ( '[Vue Final Modal] options.context is not exist.' )
81
83
if ( options . modelValue )
82
- return Promise . resolve ( '[Vue Final Modal] modal is already opened' )
84
+ return Promise . resolve ( '[Vue Final Modal] modal is already opened. ' )
83
85
86
+ destroy ( )
84
87
options . modelValue = true
85
- options . context ?. dynamicModals . push ( options )
88
+ options . context . dynamicModals . push ( options )
89
+
86
90
return new Promise ( ( resolve ) => {
87
91
options . resolveOpened = ( ) => resolve ( 'opened' )
88
92
} )
89
93
}
90
94
91
95
function close ( ) : Promise < string > {
92
96
if ( ! options . modelValue )
93
- return Promise . resolve ( '[Vue Final Modal] modal is already closed' )
97
+ return Promise . resolve ( '[Vue Final Modal] modal is already closed. ' )
94
98
95
99
options . modelValue = false
96
100
return new Promise ( ( resolve ) => {
You can’t perform that action at this time.
0 commit comments