Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: event "@update:" syntax causes TS error
close #3100
- Loading branch information
1 parent
927d564
commit 659331c
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<div class="modal" :class="{ 'modal-large': large }" v-show="show"> | ||
<div> | ||
<slot /> | ||
</div> | ||
<div> | ||
<button type="button" @click="$emit('close')">close</button> | ||
<button type="button" @click="$emit('update:show', false)">update:show</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineEmits(['close', 'update:show']) | ||
defineProps({ | ||
show: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
large: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import ModalDialog from './comp.vue' | ||
const isModalOpen1 = ref(false) | ||
const isModalOpen2 = ref(false) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div> | ||
<button @click="isModalOpen1 = true">Show Dialog 1 (<code>close</code> event)</button> | ||
<ModalDialog :show="isModalOpen1" :large="true" @close="isModalOpen1 = false"> | ||
This dialog uses the <code>close</code> event to close | ||
</ModalDialog> | ||
</div> | ||
|
||
<div> | ||
<button @click="isModalOpen2 = true">Show Dialog 2 (<code>update:show</code> event)</button> | ||
<!-- errors are on 'show' and 'large' props here --> | ||
<ModalDialog :show="isModalOpen2" :large="true" @update:show="isModalOpen2 = $event"> | ||
This dialog uses the <code>update:show</code> event to close | ||
</ModalDialog> | ||
</div> | ||
</div> | ||
</template> |