UPDATE

上级 27271c7e
<script setup> <script setup>
import parent from './子组件传值给父组件/parent.vue'; import parent from './page/parent.vue';
</script> </script>
<template> <template>
......
...@@ -10,8 +10,8 @@ const val = () => { ...@@ -10,8 +10,8 @@ const val = () => {
<template> <template>
<div class="title"> <div class="title">
<h3>我是子组件</h3><br/> <h1>我是子组件</h1>
<button @click="val">击获取子组件的</button> <button @click="val">我给你</button>
</div> </div>
</template> </template>
...@@ -21,7 +21,10 @@ const val = () => { ...@@ -21,7 +21,10 @@ const val = () => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column;
height: 100px;
background-color: rgba(255, 0, 234, 0.377); background-color: rgba(255, 0, 234, 0.377);
color: rgba(255, 0, 234, 0.377);
} }
.title:hover { .title:hover {
......
...@@ -11,7 +11,8 @@ const getVal = (data) => { ...@@ -11,7 +11,8 @@ const getVal = (data) => {
<template> <template>
<child @value="getVal"></child> <child @value="getVal"></child>
<div class="content"> <div class="content">
<div> <h1>我是父组件</h1>
<div style="color: black;">
获取子组件的值:{{ game }} 获取子组件的值:{{ game }}
</div> </div>
</div> </div>
...@@ -22,7 +23,10 @@ const getVal = (data) => { ...@@ -22,7 +23,10 @@ const getVal = (data) => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column;
height: 100px;
background-color: rgba(115, 255, 0, 0.377); background-color: rgba(115, 255, 0, 0.377);
color: rgba(115, 255, 0, 0.377);
} }
.content:hover { .content:hover {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册