当前位置:网站首页>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>
边栏推荐
- Can MySQL customize variable parameter storage functions?
- The database consists of stored procedures and functions
- Flutter integrated Aurora push
- Database composition view
- Emerging security providers to learn about in 2022
- How to optimize a large number of if else [email protected] Detailed explanation of valib
- 最好的工程师,就是这样被你“逼”走的!
- 基于C#实现的学生考试系统
- 【TypeScript】TypeScript常用类型(上篇)
- 父组件访问子组件的方法或参数 (子组件暴漏出方法defineExpose)
猜你喜欢

Today's sleep quality record 75 points

Removable tablespace

基于C#实现的学生考试系统

基于Bézier曲线的三维造型与渲染
![[typescript] typescript common types (Part 2)](/img/6b/2ac07f16af044bdfb719753ae241cc.png)
[typescript] typescript common types (Part 2)

postgresql官网下载出错

基于ASP.NET的某高校学院档案管理系统

Food safety | what food can be heated in a microwave oven? You should know these potential safety hazards

基于Locust框架进行文件上传下载性能测试

PXE原理与配置
随机推荐
Kubernetes---- installing and deploying NFS servers
华为年内二度招聘“天才少年”;540万Twitter账号信息泄露,卖价3万美元;谷歌解雇了相信AI有意识的工程师|极客头条...
维度灾难 维数灾难 暂记
Use positioning to realize left, middle and right layout, and the middle content is adaptive
Interviewer: how to understand QPS, TPS, RT?
Px2rem loader converts PX into REM and adapts to mobile vant UI and other frameworks
【5GC】什么是5G切片?5G切片如何工作?
RMII, smii, gmii, rgmii interfaces of Ethernet Driver
Database composition table
LCD笔记(6)LCD驱动程序框架_配置引脚
Kubernetes Flannel:HOST-GW模式
Solution: unable to load the file c:\users\user\appdata\roaming\npm\npx PS1, because running scripts is prohibited on this system.
Data query where
Food safety | these common foods are poisonous! Check your dining table quickly
V00 - do whatever you want when you are old
为什么要做“密评”?
基于ASP.NET的某高校学院档案管理系统
From January to June, China's ADAS suppliers accounted for 9%, and another parts giant comprehensively laid out the new smart drive track
食品安全 | 随便果可以”随便“吃吗?
Flutter integrated Aurora push