|
|
@@ -0,0 +1,19 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <h1 class="h-26 text-6xl">子组件1</h1>
|
|
|
+ <h1 class="h-26 text-6xl">我有{{ flower }}朵花</h1>
|
|
|
+ <button @click="sendFlower">给朋友一些花</button>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { ref, reactive } from "vue";
|
|
|
+import emitter from "@/utils/emitter.js";
|
|
|
+let flower = ref(10);
|
|
|
+const sendFlower = () => {
|
|
|
+ emitter.emit("xxx", flower.value / 2);
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|