mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-28 06:49:24 +08:00
initial commit
This commit is contained in:
21
src/components/ClickOutSide/index.vue
Normal file
21
src/components/ClickOutSide/index.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<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>
|
Reference in New Issue
Block a user