Fixed #2853 - Overlay components don't work with SSR

pull/2862/head
mertsincan 2022-08-16 12:46:50 +01:00
parent 4f5ae18904
commit ac714283c5
1 changed files with 13 additions and 6 deletions

View File

@ -2,9 +2,11 @@
<template v-if="inline">
<slot></slot>
</template>
<Teleport v-else-if="isClient" :to="appendTo">
<slot></slot>
</Teleport>
<template v-else-if="mounted">
<Teleport :to="appendTo">
<slot></slot>
</Teleport>
</template>
</template>
<script>
@ -22,12 +24,17 @@ export default {
default: false
}
},
data() {
return {
mounted: false
}
},
mounted() {
this.mounted = DomHandler.isClient();
},
computed: {
inline() {
return this.disabled || this.appendTo === 'self';
},
isClient() {
return DomHandler.isClient();
}
}
}