File tree Expand file tree Collapse file tree 10 files changed +60
-25
lines changed
src/components/VueFinalModal Expand file tree Collapse file tree 10 files changed +60
-25
lines changed Original file line number Diff line number Diff line change 16
16
"dependencies" : {
17
17
"@vorms/core" : " ^1.1.0" ,
18
18
"@vue-final-modal/nuxt" : " workspace:1.0.3" ,
19
- "vue-final-modal" : " workspace:4.5.2 " ,
19
+ "vue-final-modal" : " workspace:4.5.3 " ,
20
20
"vue3-drag-resize" : " ^2.0.5"
21
21
}
22
22
}
Original file line number Diff line number Diff line change 15
15
},
16
16
"dependencies" : {
17
17
"@vue-final-modal/nuxt" : " ^1.0.3" ,
18
- "vue-final-modal" : " ^4.5.2 "
18
+ "vue-final-modal" : " ^4.5.3 "
19
19
}
20
20
}
Original file line number Diff line number Diff line change 10
10
},
11
11
"dependencies" : {
12
12
"vue" : " ^3.3.7" ,
13
- "vue-final-modal" : " ^4.5.2 "
13
+ "vue-final-modal" : " ^4.5.3 "
14
14
},
15
15
"devDependencies" : {
16
16
"@iconify/vue" : " ^4.1.1" ,
Original file line number Diff line number Diff line change 24
24
},
25
25
"dependencies" : {
26
26
"@nuxt/kit" : " ^3.8.2" ,
27
- "vue-final-modal" : " ^4.5.2 "
27
+ "vue-final-modal" : " ^4.5.3 "
28
28
},
29
29
"devDependencies" : {
30
30
"@nuxt/module-builder" : " ^0.5.4" ,
Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import { VueFinalModal } from ' ~/index'
3
+ </script >
4
+
5
+ <template >
6
+ <VueFinalModal v-slot =" { close }" >
7
+ <button @click =" () => close()" >
8
+ Close
9
+ </button >
10
+ </VueFinalModal >
11
+ </template >
Original file line number Diff line number Diff line change
1
+ import App from './App.vue'
2
+ import ModalCloseByScopedSlot from './ModalCloseByScopedSlot.vue'
3
+ import { createVfm , useModal } from '~/index'
4
+
5
+ describe ( 'Test scopedSlot' , ( ) => {
6
+ it ( 'close() scoped slot ' , ( ) => {
7
+ const vfm = createVfm ( )
8
+ const modalName = 'modal-close-by-scoped-slot'
9
+ useModal ( {
10
+ defaultModelValue : true ,
11
+ component : ModalCloseByScopedSlot ,
12
+ attrs : { class : modalName } ,
13
+ } )
14
+
15
+ cy . mount ( App , {
16
+ global : {
17
+ plugins : [ vfm ] ,
18
+ stubs : { transition : false } ,
19
+ } ,
20
+ } ) . as ( 'app' )
21
+
22
+ cy . get ( `.${ modalName } ` ) . should ( 'exist' )
23
+ cy . get ( `.${ modalName } ` ) . find ( 'button' ) . click ( )
24
+ cy . get ( `.${ modalName } ` ) . should ( 'not.exist' )
25
+ } )
26
+ } )
Original file line number Diff line number Diff line change 38
38
"@cypress/vue" : " ^5.0.5" ,
39
39
"@release-it/conventional-changelog" : " ^5.1.1" ,
40
40
"@vue-macros/volar" : " ^0.8.4" ,
41
- "cypress" : " ^13.6.0 " ,
41
+ "cypress" : " ^13.6.4 " ,
42
42
"release-it" : " ^16.1.3" ,
43
43
"unplugin-vue-define-options" : " ^1.3.8" ,
44
44
"unplugin-vue-macros" : " ^2.3.0" ,
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ defineOptions({ inheritAttrs: false })
35
35
const instance = getCurrentInstance ()
36
36
37
37
defineSlots <{
38
- ' default' ? (props : { close: () => boolean }): void
38
+ ' default' ? (props : { close: () => void }): void
39
39
' swipe-banner' ? (): void
40
40
}>()
41
41
@@ -135,6 +135,11 @@ function close(): boolean {
135
135
return true
136
136
}
137
137
138
+ /** Close function for scoped slot */
139
+ function _close() {
140
+ modelValueLocal .value = false
141
+ }
142
+
138
143
onBeforeUnmount (() => {
139
144
enableBodyScroll ()
140
145
arrayRemoveItem (modals , instance )
@@ -223,7 +228,7 @@ defineExpose({
223
228
v-bind =" bindSwipe"
224
229
@mousedown =" () => onMousedown()"
225
230
>
226
- <slot v-bind =" { close }" />
231
+ <slot v-bind =" { close: _close }" />
227
232
228
233
<div
229
234
v-if =" showSwipeBanner"
Original file line number Diff line number Diff line change 8
8
},
9
9
"dependencies" : {
10
10
"vue" : " ^3.3.7" ,
11
- "vue-final-modal" : " workspace:4.5.2 " ,
11
+ "vue-final-modal" : " workspace:4.5.3 " ,
12
12
"vue-router" : " ^4.2.5"
13
13
},
14
14
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments