当前位置:网站首页>子组件传递给父组件
子组件传递给父组件
2022-07-07 03:12:00 【要成为光的女人】
1.什么样的情况下子组件祖尧传递内容到付组件呢?
- 当子组件有一些事件发生的时候,比如在组件中发生了点击,父组件需要切换内容;
- 子组件有一些内容想要传递给父组件的时候;
我们如何完成上面的操作呢?
- 首先,我们需要在子组件中定义好在某些情况下触发的事件名称;
- 其次,在父组件中以v-on 的方式传入要监听的事件名称,并且绑定到对应的方法中
- 最后,在子组件中发生某个事件的时候,根据事件名称触发对应的事件;
小案例:



传递事件时,同时也可以传递一个参数。

接收处理这个参数:

边栏推荐
- Matlab tips (29) polynomial fitting plotfit
- 请教一下,监听pgsql ,怎样可以监听多个schema和table
- MySql用户权限
- Algorithm --- bit count (kotlin)
- from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error
- .net 5 FluentFTP连接FTP失败问题:This operation is only allowed using a successfully authenticated context
- 多线程与高并发(9)——AQS其他同步组件(Semaphore、ReentrantReadWriteLock、Exchanger)
- Several index utilization of joint index ABC
- 反射(二)
- Stack and queue-p79-10 [2014 unified examination real question]
猜你喜欢

Leetcode t1165: log analysis

Several index utilization of joint index ABC

MOS tube parameters μ A method of Cox

MATLAB小技巧(30)非线性拟合 lsqcurefit

Maze games based on JS

Prime partner of Huawei machine test questions

化工园区危化品企业安全风险智能化管控平台建设四大目标
![Stack and queue-p78-8 [2011 unified examination true question]](/img/df/72ba22f1953551943494d661a56a3b.jpg)
Stack and queue-p78-8 [2011 unified examination true question]

SolidWorks的GB库(钢型材库,包括铝型材、铝管等结构)安装及使用教程(生成铝型材为例)

企業如何進行數據治理?分享數據治理4個方面的經驗總結
随机推荐
Stack and queue-p79-9
Matlab tips (29) polynomial fitting plotfit
How to install swoole under window
oracle如何备份索引
This article introduces you to the characteristics, purposes and basic function examples of static routing
MySQL user permissions
网络基础 —— 报头、封装和解包
【NOI模拟赛】区域划分(结论,构造)
Please tell me how to monitor multiple schemas and tables by listening to PgSQL
jdbc数据库连接池使用问题
Redhat5 installing vmware tools under virtual machine
Distributed ID solution
ESXI挂载移动(机械)硬盘详细教程
Several index utilization of joint index ABC
从零到一,教你搭建「CLIP 以文搜图」搜索服务(二):5 分钟实现原型
How can gyms improve their competitiveness?
Networkx绘图和常用库函数坐标绘图
Prompt for channel security on the super-v / device defender side when installing vmmare
多个kubernetes集群如何实现共享同一个存储
RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`问题解决