父组件
<template>
<div>
<h1 class="father">我是父组件曹操</h1>
<child :money="money" :info="info"></child>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import child from "./child.vue";
let money = ref(10001);
let info = ref(10002);
onMounted(() => {
console.log(money);
});
</script>
<style>
.father {
width: 100%;
height: 200px;
background: burlywood;
}
</style>
子组件
<template>
<div class="child">
<h2>我是子组件曹植</h2>
<h3>父亲传递过来的{
{ money }}--{
{ info }}</h3>
</div>