当前位置:网站首页>鸿蒙第四次学习
鸿蒙第四次学习
2022-07-02 17:08:00 【菜鸟不是】
1.tabs

2.list

3.自定义组件
自定义组件是用户根据业务需求,将已有的组件组合,封装成的新组件,可以在工程中多次调用,从而提高代码的可读性。自定义组件通过element引入到宿主页面,使用方法如下 :
<element name='comp' src='../../common/component/comp.hml'></element>
<div>
<comp prop1='xxxx' @child1="bindParentVmMethod"></comp>
</div>结合if-else使用自定义组件的示例:
<element name='comp1' src='../../common/component/comp1/comp1.hml'></element>
<element name='comp2' src='../../common/component/comp2/comp2.hml'></element>
<div>
<comp1 if="{
{showComp1}}" prop1='xxxx' @child1="bindParentVmMethodOne"></comp1>
<comp2 else prop1='xxxx' @child1="bindParentVmMethodTwo"></comp2>
</div>- name属性指自定义组件名称(非必填),组件名称对大小写不敏感,默认使用小写。src属性指自定义组件hml文件路径(必填),若没有设置name属性,则默认使用hml文件名作为组件名。
- 事件绑定:自定义组件中绑定子组件事件使用(on|@)child1语法,子组件中通过this.$emit('child1', { params: '传递参数' })触发事件并进行传值,父组件执行bindParentVmMethod方法并接收子组件传递的参数。

边栏推荐
- Three methods of MySQL backup
- 在支付宝账户上买基金安全吗
- 链游系统开发(Unity3D链游开发详情)丨链游开发成熟技术源码
- Picking up the camera is the best artistic healing
- How to set vscode to delete the whole line shortcut key?
- Leetcode interview question 17.04 Vanishing numbers
- Troubleshooting ideas that can solve 80% of faults
- Tower safety monitoring system unattended inclination vibration monitoring system
- cJSON 使用详解
- Wechat nucleic acid detection and appointment applet system graduation design (3) background function
猜你喜欢

Chrome 正式支持 MathML,默认在 Chromium Dev 105 中启用

Nm01 function overview and API definition of nm module independent of bus protocol
![[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations](/img/15/298ea6f7367741e1e085007c498e51.jpg)
[Northwestern Polytechnic University] information sharing of the first and second postgraduate examinations
![[Yugong series] July 2022 go teaching course 001 introduction to go language premise](/img/f2/3b95f53d67cd1d1979163910dbeeb8.png)
[Yugong series] July 2022 go teaching course 001 introduction to go language premise

Wechat applet video sharing platform system graduation design (2) applet function

Leetcode(81)——搜索旋转排序数组 II

夜神模擬器+Fiddler抓包測試App

RDK仿真实验

Wechat nucleic acid detection appointment applet system graduation design completion (5) task statement

Qt官方示例:Qt Quick Controls - Gallery
随机推荐
Leetcode 面试题 17.04. 消失的数字
paddlepaddle 28 搭建基于卷积的自动编码机
Leetcode 面试题 16.17. 连续数列
2020 Internet industry terminology
元宇宙链游系统开发(逻辑开发)丨链游系统开发(详细分析)
QQmlApplicationEngine
Wechat applet video sharing platform system graduation design (3) background function
Three methods of MySQL backup
Babbitt | metauniverse daily must read: can you buy a virtual anchor for 1000 yuan? Is this the live gospel of small businesses or "cutting leeks"
工业软件讲堂-三维CAD设计软件的核心技术解析----讲坛第二次讲座
Matlab中弧度转角度、角度转弧度
Qt Official examples: Qt Quick Controls - Gallery
Three ways of function parameter transfer in C language
Another double non reform exam 408, will it be cold? Software College of Nanchang Aviation University
Leetcode 面试题 17.01. 不用加号的加法
RDK仿真实验
Wechat nucleic acid detection appointment applet system graduation design (2) applet function
UE4 用spline画正圆
MySQL 关于 only_full_group_by 限制
Leetcode 面试题 16.11. 跳水板