<template>
  <div>
    <h1>Child2</h1>
    <h3>我收到了兄弟的红包：{{ red }}元</h3>
  </div>
</template>

<script lang="ts" setup>
import emitter from "@/utils/emitter"
import {ref,onUnmounted} from "vue" 
let red = ref(0)
emitter.on('aa',(val:number)=>{
    console.log('收到兄弟的红包')
    red.value = val;
})
onUnmounted(()=>{
    emitter.off('aa')
})  
</script>

<style lang="scss" scoped>
</style>
