|
|
@@ -1,16 +1,29 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<h1 class="h-26 text-6xl">Attrs</h1>
|
|
|
- <h3 class="h-16 text-4xl"></h3>
|
|
|
+ <h3 class="h-16 text-4xl">我有{{ flower }}朵花</h3>
|
|
|
+ <button @click="sendMain">给出去一些花</button>
|
|
|
+
|
|
|
+ <h3 class="h-16 text-4xl">我收到了{{ main }}朵花</h3>
|
|
|
<hr class="h-15" />
|
|
|
<hr class="h-15" />
|
|
|
- <Child></Child>
|
|
|
+ <Child :news="news" @back="changeMain"></Child>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, reactive } from "vue";
|
|
|
import Child from "./Child.vue";
|
|
|
+let flower = ref(10);
|
|
|
+let news = ref(0);
|
|
|
+const sendMain = () => {
|
|
|
+ news.value += 1;
|
|
|
+ flower.value -= 1;
|
|
|
+};
|
|
|
+let main = ref(0);
|
|
|
+const changeMain = (val) => {
|
|
|
+ main.value += val;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|