YangYuGang
2025-03-08 8cae1dcd8d2bde01880ac4b70bdda4e61df3c7ef
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<template>
  <PageWrapper title="点内外部触发事件">
    <ClickOutSide @click-outside="handleClickOutside" class="flex justify-center">
      <div
        @click="innerClick"
        class="flex items-center justify-center w-full h-300px border-10px bg-blue-500 text-white text-24px"
      >
        {{ text }}
      </div>
    </ClickOutSide>
  </PageWrapper>
</template>
<script lang="ts" setup>
  import { ref } from 'vue';
  import { ClickOutSide } from '@/components/ClickOutSide';
  import { PageWrapper } from '@/components/Page';
 
  const text = ref('Click');
 
  function handleClickOutside() {
    text.value = 'Click Out Side';
  }
 
  function innerClick() {
    text.value = 'Click Inner';
  }
</script>