dialog.vue 803 B

1234567891011121314151617181920212223242526272829
  1. <template>
  2. <teleport to="body">
  3. <div v-if="show" class="ui-dialog" :style="{ zIndex: zIndex }">
  4. <dialog-content>
  5. <template v-for="(slot, name) in $slots" #[name]="raw">
  6. <slot :name="name" v-bind="raw" />
  7. </template>
  8. </dialog-content>
  9. </div>
  10. </teleport>
  11. </template>
  12. <script lang="ts">
  13. import { defineComponent, ref } from 'vue'
  14. import { useZIndex } from '@kankan-components/hooks'
  15. import DialogContent from './dialog-content.vue'
  16. const { currentZIndex } = useZIndex()
  17. export default defineComponent({
  18. name: 'UIDialog',
  19. components: { DialogContent },
  20. setup() {
  21. const show = ref(true)
  22. return {
  23. show,
  24. zIndex: currentZIndex,
  25. }
  26. },
  27. })
  28. </script>