kui-dialog.vue 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script setup lang="ts">
  2. defineProps({
  3. show: {
  4. type: Boolean,
  5. default: false
  6. },
  7. className: {
  8. type: String,
  9. default: ''
  10. }
  11. })
  12. defineEmits(['close'])
  13. // function closeHandle() {
  14. // emit('closeEvent');
  15. // console.log('closeHandle')
  16. // }
  17. // function findDom (t = 0 ){
  18. // let dom = document.getElementById('#kui-dialog')
  19. // if(!dom && t < 10)
  20. // {
  21. // setTimeout(() => {
  22. // return findDom(t++)
  23. // }, 1000)
  24. // }
  25. // // 尝试获取body
  26. // dom = document.body
  27. // return dom
  28. // }
  29. //
  30. // function eventBind(){
  31. // window.addEventListener('click', (e) => {
  32. // console.log(e.target)
  33. // let parentDom = findDom();
  34. // if (e.target != parentDom){
  35. // e.preventDefault()
  36. // e.stopPropagation()
  37. // }
  38. // }, true)
  39. // }
  40. // 给插入位置的dom组件添加事件, 屏蔽所有事件
  41. </script>
  42. <template>
  43. <Teleport to="#kui-root" v-if="show">
  44. <div :class="className">
  45. <slot></slot>
  46. </div>
  47. </Teleport>
  48. </template>
  49. <style scoped>
  50. </style>