当前位置:网站首页>The child component triggers the defineemits of the parent component: the child component passes values to the parent component
The child component triggers the defineemits of the parent component: the child component passes values to the parent component
2022-07-26 13:04:00 【@Little Zhu Yalu】
Parent component
<template>
<div>
<Menu @onclick="getList" @onclick2="getList2" />
</div>
</template>
<script setup lang="ts">
import {
reactive ,ref} from 'vue'
const getList=(list:number[])=>{
console.log(list)
}
const getList2=(list:number[])=>{
console.log(list)
}
</script>
<style scoped>
</style>
Child components
<template>
<div class="menu">
<div class="">
<button @click="clickTap"> distributed 1</button>
<button @click="clickTap2"> distributed 2</button>
</div>
</div>
</template>
<script setup lang="ts">
import {
reactive, defineEmits} from 'vue';
const list=reactive<number[]>([6,6,6,6])//number The array value of type is [6,6,6,6]
const list2=reactive<string>('11')
const emit=defineEmits(['onclick','onclick2']);
const clickTap=()=>{
emit('onclick',list)
}
const clickTap2=()=>{
emit('onclick2',list2)
}
</script>
边栏推荐
- Who is responsible for the problems of virtual idol endorsement products? And listen to the lawyer's analysis
- Qualcomm once again "bet" on Zhongke Chuangda to challenge the full stack solution of intelligent driving software and hardware
- Yolov7 training dangerous goods identification pytorch
- 基于Bézier曲线的三维造型与渲染
- Kubernetes ---- life cycle introduction of PV and PVC
- (int argc, char** argv) command line parameters in visual stdio (VS)
- Huawei ultra fusion fusioncube solution notes
- Flutter textfield sets the height and automatically wraps lines, and the rounded border removes the underline
- Kuzaobao: summary of Web3 encryption industry news on July 25
- Visual stdio(VS)中的(int argc、char** argv)命令行参数
猜你喜欢

C regards type as generic type T and uses it as generic type of method

Kubernetes----PV和PVC的生命周期简介

Elementary notes of binary tree
![[applet] why can't the onreachbottom event be triggered? (one second)](/img/da/3641040c63f6db4d227dcf2ff89919.png)
[applet] why can't the onreachbottom event be triggered? (one second)

【上位机教程】CANopen通信下一体化步进电机与台达PLC(AS228T)的应用

Ue5 official case Lyra full feature explanation 7. resource management

食品安全 | 微波炉什么食品都能加热?这些安全隐患要知道

Food safety | these common foods are poisonous! Check your dining table quickly

Version of NDK matched the requested version 21.0.6113669. versions available locally: 2

1312_适用7z命令进行压缩与解压
随机推荐
食品安全 | 网购的自制食品就是健康食品?莫要陷入这些误区
If there is a declaration "int x=5, y=1;", Then the expression x < y? The result of x++: y++ is:
Flutter dart generates a list of random numbers that are not repeated in n intervals
How to view encrypted information in text form
RMII, smii, gmii, rgmii interfaces of Ethernet Driver
StreamNative 团队文化:一家“透明”的公司
(int argc, char** argv) command line parameters in visual stdio (VS)
LCD notes (6) LCD driver framework_ Configuration pin
Food safety | can you eat any fruit?
基于C#实现的学生考试系统
Detailed interpretation of hole convolution (input and output size analysis)
Detailed explanation of redisson distributed lock process (II)
可移动表空间
Yolov7 training dangerous goods identification pytorch
一文看懂GaitSet中的test.py
Does Flink CDC only support SQL client to submit SQL scripts
Food safety | these common foods are poisonous! Check your dining table quickly
Slam 02. overall framework
How to optimize a large number of if else [email protected] Detailed explanation of valib
MySQL可以自定义变参存储函数吗?