# ClickOutSide

用于监听包裹的元素点击外部触发事件

## 代码演示

<CodePreview src="/doc-feat/click-out-side" :height="500">
<details>
<summary>展开查看</summary>

```vue
<template>
  <PageWrapper title="点内外部触发事件">
    <ClickOutSide class="flex justify-center" @click-outside="handleClickOutside">
      <div class="demo-box" @click="innerClick">
        {{ text }}
      </div>
    </ClickOutSide>
  </PageWrapper>
</template>
<script lang="ts" setup>
  import { PageWrapper } from '@eciol/ant-ui';
  import { ClickOutSide } from '@eciol/share-ui';

  const text = ref('Click');
  function handleClickOutside() {
    text.value = 'Click Out Side';
  }

  function innerClick() {
    text.value = 'Click Inner';
  }
</script>

<style lang="less" scoped>
  .demo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 300px;
    font-size: 24px;
    color: #fff;
    background-color: #408ede;
    border-radius: 10px;
  }
</style>

```
</details>
</CodePreview>

## Usage

```vue
<template>
  <div>
    <ClickOutSide @clickOutside="() => (showRef = false)">
      <div @click="() => (showRef = true)">
        {{ showRef ? '鼠标点击那部（点击边框外可以恢复）' : '点击该区域状态(初始状态)' }}
      </div>
    </ClickOutSide>
  </div>
</template>
<script setup lang="ts">
  import { ClickOutSide } from '@eciol/share-ui';
  const showRef = ref(false);
</script>
```

## Events

| 事件         | 回调参数   | 说明                     |
| ------------ | ---------- | ------------------------ |
| clickOutside | `()=>void` | 点击包裹元素外部区域触发 |

## Slots

| 名称    | 说明         |
| ------- | ------------ |
| default | 被包裹的元素 |
