Skip to content

Commit

Permalink
[TASK] Add teleport workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
lolamtisch committed Aug 31, 2022
1 parent 448f53e commit 4945c99
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/_minimal/components/modal.vue
@@ -1,17 +1,17 @@
<template>
<teleport to="html">
<component :is="Teleport" to="html">
<transition name="fade-shrink-in" appear>
<div v-if="state" class="modal" @click="state = false">
<div class="content" @click.stop>
<slot></slot>
</div>
</div>
</transition>
</teleport>
</component>
</template>

<script lang="ts" setup>
import { ref, watch } from 'vue';
import { Teleport as teleport_, type TeleportProps, type VNodeProps, ref, watch } from 'vue';
const props = defineProps({
modelValue: {
Expand All @@ -33,6 +33,13 @@ watch(
state.value = value;
},
);
// https://github.com/vuejs/core/issues/2855
const Teleport = teleport_ as {
new (): {
$props: VNodeProps & TeleportProps;
};
};
</script>

<style lang="less" scoped>
Expand Down

0 comments on commit 4945c99

Please sign in to comment.