diff --git a/docs/package.json b/docs/package.json
index 5f8b17ff..fce3b1ce 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -16,7 +16,7 @@
"dependencies": {
"@vorms/core": "^1.1.0",
"@vue-final-modal/nuxt": "workspace:1.0.3",
- "vue-final-modal": "workspace:4.5.2",
+ "vue-final-modal": "workspace:4.5.3",
"vue3-drag-resize": "^2.0.5"
}
}
diff --git a/examples/nuxt3/package.json b/examples/nuxt3/package.json
index 35fc55cb..60c63d20 100644
--- a/examples/nuxt3/package.json
+++ b/examples/nuxt3/package.json
@@ -15,6 +15,6 @@
},
"dependencies": {
"@vue-final-modal/nuxt": "^1.0.3",
- "vue-final-modal": "^4.5.2"
+ "vue-final-modal": "^4.5.3"
}
}
diff --git a/examples/vue3/package.json b/examples/vue3/package.json
index 74f03111..c702d9bc 100644
--- a/examples/vue3/package.json
+++ b/examples/vue3/package.json
@@ -10,7 +10,7 @@
},
"dependencies": {
"vue": "^3.3.7",
- "vue-final-modal": "^4.5.2"
+ "vue-final-modal": "^4.5.3"
},
"devDependencies": {
"@iconify/vue": "^4.1.1",
diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json
index ab9533b5..ff648f2c 100644
--- a/packages/nuxt/package.json
+++ b/packages/nuxt/package.json
@@ -24,7 +24,7 @@
},
"dependencies": {
"@nuxt/kit": "^3.8.2",
- "vue-final-modal": "^4.5.2"
+ "vue-final-modal": "^4.5.3"
},
"devDependencies": {
"@nuxt/module-builder": "^0.5.4",
diff --git a/packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue b/packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue
new file mode 100644
index 00000000..5a29d139
--- /dev/null
+++ b/packages/vue-final-modal/cypress/components/ModalCloseByScopedSlot.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/packages/vue-final-modal/cypress/components/scopedSlot.spec.ts b/packages/vue-final-modal/cypress/components/scopedSlot.spec.ts
new file mode 100644
index 00000000..e425776f
--- /dev/null
+++ b/packages/vue-final-modal/cypress/components/scopedSlot.spec.ts
@@ -0,0 +1,26 @@
+import App from './App.vue'
+import ModalCloseByScopedSlot from './ModalCloseByScopedSlot.vue'
+import { createVfm, useModal } from '~/index'
+
+describe('Test scopedSlot', () => {
+ it('close() scoped slot ', () => {
+ const vfm = createVfm()
+ const modalName = 'modal-close-by-scoped-slot'
+ useModal({
+ defaultModelValue: true,
+ component: ModalCloseByScopedSlot,
+ attrs: { class: modalName },
+ })
+
+ cy.mount(App, {
+ global: {
+ plugins: [vfm],
+ stubs: { transition: false },
+ },
+ }).as('app')
+
+ cy.get(`.${modalName}`).should('exist')
+ cy.get(`.${modalName}`).find('button').click()
+ cy.get(`.${modalName}`).should('not.exist')
+ })
+})
diff --git a/packages/vue-final-modal/package.json b/packages/vue-final-modal/package.json
index 8e18eca8..7a23ac02 100644
--- a/packages/vue-final-modal/package.json
+++ b/packages/vue-final-modal/package.json
@@ -38,7 +38,7 @@
"@cypress/vue": "^5.0.5",
"@release-it/conventional-changelog": "^5.1.1",
"@vue-macros/volar": "^0.8.4",
- "cypress": "^13.6.0",
+ "cypress": "^13.6.4",
"release-it": "^16.1.3",
"unplugin-vue-define-options": "^1.3.8",
"unplugin-vue-macros": "^2.3.0",
diff --git a/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue b/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue
index df66c455..061b7354 100644
--- a/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue
+++ b/packages/vue-final-modal/src/components/VueFinalModal/VueFinalModal.vue
@@ -35,7 +35,7 @@ defineOptions({ inheritAttrs: false })
const instance = getCurrentInstance()
defineSlots<{
- 'default'?(props: { close: () => boolean }): void
+ 'default'?(props: { close: () => void }): void
'swipe-banner'?(): void
}>()
@@ -135,6 +135,11 @@ function close(): boolean {
return true
}
+/** Close function for scoped slot */
+function _close() {
+ modelValueLocal.value = false
+}
+
onBeforeUnmount(() => {
enableBodyScroll()
arrayRemoveItem(modals, instance)
@@ -223,7 +228,7 @@ defineExpose({
v-bind="bindSwipe"
@mousedown="() => onMousedown()"
>
-
+
=8'}
peerDependencies:
@@ -1025,7 +1025,7 @@ packages:
'@cypress/webpack-dev-server':
optional: true
dependencies:
- cypress: 13.6.0
+ cypress: 13.6.4
vue: 3.3.9(typescript@5.3.3)
dev: true
@@ -3473,12 +3473,6 @@ packages:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
dev: true
- /@types/node@18.18.13:
- resolution: {integrity: sha512-vXYZGRrSCreZmq1rEjMRLXJhiy8MrIeVasx+PCVlP414N7CJLHnMf+juVvjdprHyH+XRy3zKZLHeNueOpJCn0g==}
- dependencies:
- undici-types: 5.26.5
- dev: true
-
/@types/node@20.10.4:
resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==}
dependencies:
@@ -6848,15 +6842,14 @@ packages:
/csstype@3.1.2:
resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==}
- /cypress@13.6.0:
- resolution: {integrity: sha512-quIsnFmtj4dBUEJYU4OH0H12bABJpSujvWexC24Ju1gTlKMJbeT6tTO0vh7WNfiBPPjoIXLN+OUqVtiKFs6SGw==}
+ /cypress@13.6.4:
+ resolution: {integrity: sha512-pYJjCfDYB+hoOoZuhysbbYhEmNW7DEDsqn+ToCLwuVowxUXppIWRr7qk4TVRIU471ksfzyZcH+mkoF0CQUKnpw==}
engines: {node: ^16.0.0 || ^18.0.0 || >=20.0.0}
hasBin: true
requiresBuild: true
dependencies:
'@cypress/request': 3.0.1
'@cypress/xvfb': 1.2.4(supports-color@8.1.1)
- '@types/node': 18.18.13
'@types/sinonjs__fake-timers': 8.1.1
'@types/sizzle': 2.3.3
arch: 2.2.0
diff --git a/viteplay/package.json b/viteplay/package.json
index 62cab4fc..268145e3 100644
--- a/viteplay/package.json
+++ b/viteplay/package.json
@@ -8,7 +8,7 @@
},
"dependencies": {
"vue": "^3.3.7",
- "vue-final-modal": "workspace:4.5.2",
+ "vue-final-modal": "workspace:4.5.3",
"vue-router": "^4.2.5"
},
"devDependencies": {