diff --git a/package.json b/package.json index dfd7399..bf01136 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,7 @@ "build": "nuxt-module-build", "dev": "nuxi dev playground", "prepare": "nuxi prepare playground", - "lint": "eslint .", - "test": "vitest run", - "test:coverage": "pnpm test -- --reporter verbose --coverage" + "lint": "eslint ." }, "devDependencies": { "@antfu/eslint-config": "latest", @@ -40,7 +38,7 @@ "@vueuse/components": "latest", "@vueuse/core": "latest", "eslint": "latest", - "nuxt": "^3.0.0-rc.6", + "nuxt": "^3.0.0-rc.11", "typescript": "latest" } } diff --git a/playground/app.vue b/playground/app.vue index a852654..9673df7 100644 --- a/playground/app.vue +++ b/playground/app.vue @@ -1,6 +1,12 @@ + + diff --git a/playground/components/MyModal.vue b/playground/components/MyModal.vue index 1e08b5a..94602f0 100644 --- a/playground/components/MyModal.vue +++ b/playground/components/MyModal.vue @@ -2,34 +2,36 @@ import { vOnClickOutside } from '@vueuse/components' import { useFocus } from '@vueuse/core' -interface Emits { +const props = defineProps({ + text: { + type: String, + required: true, + }, +}) + +const emit = defineEmits<{ (event: 'close', text: string | null): void -} +}>() -const emit = defineEmits() -const close = () => emit('close', null) -const closeWithText = (text: string) => emit('close', text) +const close = (text?: string | MouseEvent) => emit('close', typeof text === 'string' ? text : null) const focusTarget = ref() useFocus(focusTarget, { initialValue: true }) -const text = ref('') +const text = ref(props.text)