当前位置:网站首页>父组件传递给子组件:Props
父组件传递给子组件:Props
2022-07-07 03:12:00 【要成为光的女人】
一、在开发中很常见的就是父组件之间通信,比如父组件有一些数据,需要子组件进行展示;
- 这个时候我们可以通过props来完成组件之间的通信;
二、什么是Props呢?
- Props是你可以在组件上注册一些自定义的attribute;
- 父组件给这些attribute赋值,子组件通过attribute的名称获取到对应的值;
三、Props有两种常见的用法:
- 方式一:字符串数组,数组中的字符串就是attribute的名称;
- 方式二:对象类型,对象类型可以在指定attribute名称的同时,指定它传递的类型,是否是必须的、默认值等等;
方式一:动态数据要加冒号

方式二:

边栏推荐
猜你喜欢

Jetpack compose is much more than a UI framework~

How to share the same storage among multiple kubernetes clusters

Sword finger offer high quality code

Complete process of MySQL SQL

. Net core accesses uncommon static file types (MIME types)

Prompt for channel security on the super-v / device defender side when installing vmmare

MySQL的主从复制原理

Answer to the second stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition

Can 7-day zero foundation prove HCIA? Huawei certification system learning path sharing

毕业设计游戏商城
随机推荐
SVN version management in use replacement release and connection reset
根据IP获取地市
MySQL view bin log and recover data
什么情况下考虑分库分表
Leetcode T1165: 日志分析
Cloudcompare point pair selection
2022/07/04学习记录
循环肿瘤细胞——Abnova 解决方案来啦
FPGA课程:JESD204B的应用场景(干货分享)
分布式id解决方案
Mysql---- import and export & View & Index & execution plan
请教一下,监听pgsql ,怎样可以监听多个schema和table
How to do sports training in venues?
2022年全国所有A级景区数据(13604条)
Leetcode t1165: log analysis
Kotlin之 Databinding 异常
Unable to debug screen program with serial port
工具类:对象转map 驼峰转下划线 下划线转驼峰
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第一阶段答案
Lvs+kept (DR mode) learning notes