当前位置:网站首页>组件的通信
组件的通信
2022-07-07 03:12:00 【要成为光的女人】
之前在写组件嵌套讲解的时候:
App组件时headers 组件的父组件;
一、在开发过程中,我们会经常遇到组件之间相互进行通信:
- 比如App 可能使用了很多个Header,每个地方的Header展示的内容不同,那么我们就需要使用者传递Header一些数据,让其进行展示;
- 又比如我们在Main中一次性请求了Banner数据和ProductList数据,那么就需要传递给它们进行展示
- 也有可能是子组件中发生了事件,需要由父组件来完成某些操作,那就需要子组件向父组件传递事件;
二、父子组件之间通信的方式
- 父组件传递给子组件:通过props属性;
- 子组件传递给父组件:通过$emit触发事件;
边栏推荐
- 使用TCP/IP四层模型进行网络传输的基本流程
- 【luogu P1971】兔兔与蛋蛋游戏(二分图博弈)
- Unable to debug screen program with serial port
- Master-slave replication principle of MySQL
- Config分布式配置中心
- 7天零基础能考证HCIA吗?华为认证系统学习路线分享
- Learning records on July 4, 2022
- 【NOI模拟赛】区域划分(结论,构造)
- Problems and precautions about using data pumps (expdp, impdp) to export and import large capacity tables in Oracle migration
- Redhat5 installing vmware tools under virtual machine
猜你喜欢
ANR 原理及实践
Four goals for the construction of intelligent safety risk management and control platform for hazardous chemical enterprises in Chemical Industry Park
从零到一,教你搭建「CLIP 以文搜图」搜索服务(二):5 分钟实现原型
Prime partner of Huawei machine test questions
Installing redis and windows extension method under win system
How to model and simulate the target robot [mathematical / control significance]
.net core 访问不常见的静态文件类型(MIME 类型)
Matlab tips (29) polynomial fitting plotfit
Complete process of MySQL SQL
Cloudcompare point pair selection
随机推荐
Big coffee gathering | nextarch foundation cloud development meetup is coming
Comment les entreprises gèrent - elles les données? Partager les leçons tirées des quatre aspects de la gouvernance des données
常用函数detect_image/predict
The startup of MySQL installed in RPM mode of Linux system failed
ip地址那点事
oracle如何备份索引
请教一个问题,flink oracle cdc,读取一个没有更新操作的表,隔十几秒就重复读取全量数据
Leetcode T1165: 日志分析
How to model and simulate the target robot [mathematical / control significance]
Jetpack compose is much more than a UI framework~
企業如何進行數據治理?分享數據治理4個方面的經驗總結
Libcurl returns curlcode description
Several index utilization of joint index ABC
Stack and queue-p79-9
Mysql---- import and export & View & Index & execution plan
Jetpack Compose 远不止是一个UI框架这么简单~
Unable to debug screen program with serial port
sqlserver多线程查询问题
Sword finger offer high quality code
DB2获取表信息异常:Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.25.13]