primevue-mirror/components/portal/Portal.vue

42 lines
773 B
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
<template v-if="inline">
<slot></slot>
</template>
<template v-else-if="mounted">
<Teleport :to="appendTo">
<slot></slot>
</Teleport>
</template>
</template>
<script>
import { DomHandler } from 'primevue/utils';
export default {
name: 'Portal',
props: {
appendTo: {
type: String,
default: 'body'
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
mounted: false
2022-09-14 11:26:01 +00:00
};
2022-09-06 12:03:37 +00:00
},
mounted() {
this.mounted = DomHandler.isClient();
},
computed: {
inline() {
return this.disabled || this.appendTo === 'self';
}
}
2022-09-14 11:26:01 +00:00
};
2022-09-06 12:03:37 +00:00
</script>