12345678910111213141516171819 |
- <template>
- <div>
- <h1>Child1</h1>
- <h3>{{ money }}元</h3>
- <button @click="sendMoney">分一半</button>
- </div>
- </template>
- <script lang="ts" setup>
- import emitter from "@/utils/emitter";
- import {ref,reactive} from "vue"
- let money = ref(1000);
- function sendMoney() {
- emitter.emit('foo',money.value / 2)
- }
- </script>
- <style lang="scss" scoped>
- </style>
|