介绍
当点击元素外部时触发回调
示例
代码
<script setup lang="ts">
const handler = () => {
window.alert('clicked outside')
}
</script>
<template>
<button v-clickoutside="handler">click</button>
</template>
<script setup lang="ts">
const handler = () => {
window.alert('clicked outside')
}
</script>
<template>
<button v-clickoutside="handler">click</button>
</template>