Skip to content

Commit 57e41a8

Browse files
Merge pull request #430 from vue-final/fix/424
Fix/424
2 parents 5e6ea7c + 175b5ab commit 57e41a8

File tree

10 files changed

+60
-25
lines changed

10 files changed

+60
-25
lines changed

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@vorms/core": "^1.1.0",
1818
"@vue-final-modal/nuxt": "workspace:1.0.3",
19-
"vue-final-modal": "workspace:4.5.2",
19+
"vue-final-modal": "workspace:4.5.3",
2020
"vue3-drag-resize": "^2.0.5"
2121
}
2222
}

examples/nuxt3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
},
1616
"dependencies": {
1717
"@vue-final-modal/nuxt": "^1.0.3",
18-
"vue-final-modal": "^4.5.2"
18+
"vue-final-modal": "^4.5.3"
1919
}
2020
}

examples/vue3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"vue": "^3.3.7",
13-
"vue-final-modal": "^4.5.2"
13+
"vue-final-modal": "^4.5.3"
1414
},
1515
"devDependencies": {
1616
"@iconify/vue": "^4.1.1",

packages/nuxt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@nuxt/kit": "^3.8.2",
27-
"vue-final-modal": "^4.5.2"
27+
"vue-final-modal": "^4.5.3"
2828
},
2929
"devDependencies": {
3030
"@nuxt/module-builder": "^0.5.4",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
})

packages/vue-final-modal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@cypress/vue": "^5.0.5",
3939
"@release-it/conventional-changelog": "^5.1.1",
4040
"@vue-macros/volar": "^0.8.4",
41-
"cypress": "^13.6.0",
41+
"cypress": "^13.6.4",
4242
"release-it": "^16.1.3",
4343
"unplugin-vue-define-options": "^1.3.8",
4444
"unplugin-vue-macros": "^2.3.0",

packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defineOptions({ inheritAttrs: false })
3535
const instance = getCurrentInstance()
3636
3737
defineSlots<{
38-
'default'?(props: { close: () => boolean }): void
38+
'default'?(props: { close: () => void }): void
3939
'swipe-banner'?(): void
4040
}>()
4141
@@ -135,6 +135,11 @@ function close(): boolean {
135135
return true
136136
}
137137
138+
/** Close function for scoped slot */
139+
function _close() {
140+
modelValueLocal.value = false
141+
}
142+
138143
onBeforeUnmount(() => {
139144
enableBodyScroll()
140145
arrayRemoveItem(modals, instance)
@@ -223,7 +228,7 @@ defineExpose({
223228
v-bind="bindSwipe"
224229
@mousedown="() => onMousedown()"
225230
>
226-
<slot v-bind="{ close }" />
231+
<slot v-bind="{ close: _close }" />
227232

228233
<div
229234
v-if="showSwipeBanner"

pnpm-lock.yaml

Lines changed: 10 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

viteplay/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"dependencies": {
1010
"vue": "^3.3.7",
11-
"vue-final-modal": "workspace:4.5.2",
11+
"vue-final-modal": "workspace:4.5.3",
1212
"vue-router": "^4.2.5"
1313
},
1414
"devDependencies": {

0 commit comments

Comments
 (0)