12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <script setup lang="ts">
- defineProps({
- show: {
- type: Boolean,
- default: false
- },
- className: {
- type: String,
- default: ''
- }
- })
- defineEmits(['close'])
- // function closeHandle() {
- // emit('closeEvent');
- // console.log('closeHandle')
- // }
- // function findDom (t = 0 ){
- // let dom = document.getElementById('#kui-dialog')
- // if(!dom && t < 10)
- // {
- // setTimeout(() => {
- // return findDom(t++)
- // }, 1000)
- // }
- // // 尝试获取body
- // dom = document.body
- // return dom
- // }
- //
- // function eventBind(){
- // window.addEventListener('click', (e) => {
- // console.log(e.target)
- // let parentDom = findDom();
- // if (e.target != parentDom){
- // e.preventDefault()
- // e.stopPropagation()
- // }
- // }, true)
- // }
- // 给插入位置的dom组件添加事件, 屏蔽所有事件
- </script>
- <template>
- <Teleport to="#kui-root" v-if="show">
- <div :class="className">
- <slot></slot>
- </div>
- </Teleport>
- </template>
- <style scoped>
- </style>
|