mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-29 06:38:40 +08:00
24 lines
532 B
Vue
24 lines
532 B
Vue
<template>
|
|
<div ref="wrapRef"><slot /></div>
|
|
</template>
|
|
<script lang="ts">
|
|
import type { Ref } from 'vue';
|
|
import { defineComponent, ref } from 'vue';
|
|
|
|
import { useClickOutside } from '/@/hooks/web/useClickOutside';
|
|
|
|
export default defineComponent({
|
|
name: 'ClickOutSide',
|
|
|
|
setup(_, { emit }) {
|
|
const wrapRef = ref<Nullable<HTMLDivElement | null>>(null);
|
|
|
|
useClickOutside(wrapRef as Ref<HTMLDivElement>, () => {
|
|
emit('clickOutside');
|
|
});
|
|
|
|
return { wrapRef };
|
|
},
|
|
});
|
|
</script>
|