<template>
  <div>
    <h1>Child2</h1>
    <h3>我有{{ toy }}个玩具</h3>
    <h2>我的兄弟给了我{{ end }}本书</h2>
  </div>
</template>

<script lang="ts" setup>
import emitter from "../../utils/emitter";
import { ref, onUnmounted } from "vue";
let toy = ref(20);
let end = ref(0);
emitter.on("foo", (val: number) => {
  console.log(val);
  end.value = val;
});
onUnmounted(() => {
  emitter.off("foo");
});
</script>

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