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
7878 options . context ?. dynamicModals . push ( options )
7979
8080 function open ( ) : Promise < string > {
81+ if ( ! options ?. context )
82+ return Promise . resolve ( '[Vue Final Modal] options.context is not exist.' )
8183 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. ' )
8385
86+ destroy ( )
8487 options . modelValue = true
85- options . context ?. dynamicModals . push ( options )
88+ options . context . dynamicModals . push ( options )
89+
8690 return new Promise ( ( resolve ) => {
8791 options . resolveOpened = ( ) => resolve ( 'opened' )
8892 } )
8993 }
9094
9195 function close ( ) : Promise < string > {
9296 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. ' )
9498
9599 options . modelValue = false
96100 return new Promise ( ( resolve ) => {
You can’t perform that action at this time.
0 commit comments