首页
CtrlK

02.鸿蒙笔记

02.鸿蒙笔记

说明+计划

主题 说明

笔记在不断整理,包括格式,目前也没确定,等完成计划的课程做一次整理。

02.鸿蒙笔记 : 这个时间线是根据课程来

01.概念:

02.问题&解决方法:

主题 计划

几乎没有任何编程基础,会遇到很多不知道的概念,所以前置知识缺很多,看不懂正常。

  • 边学边写问题库,把想到的问题都写出来,比如项目目录里的文件都是啥意思?然后查官方文档、问鸿蒙智能客服、搜论坛、问GPT等大模型

  • 完成黑马星河课程

  • 完成黑马端云一体化课程

  • 把鸿蒙课程概念梳理一遍,尽可能地整理成渐构格式学习材料

  • 开发简单的自己想做的项目

主题 经验

1 .听课时间应该是要大于课程时间的

需要自己归纳分析对比代码,

其他

column

单独一个内容,比如只有图片,会靠左,有多个就会自动居中。

padding

这个容器里面元素本来是挨着边,加点padding,就会把容器里的元素往里面挤。

margin

.margin, 改的 ' . ’前面的,往外面挤,推展空间

width

不加width:默认居中

width(100%):默认居左

主题 快捷键:

行注释 : ctrl +/

page:新增一个文件,复制index-粘贴改名,index中的内容删除。

ArkTS

03.存储数据

认识和存储数据

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z3t3b56ped50wdn0yt40goem.png)image.png

04.常量变量命名

常量和变量的命名规则

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rej8q6o3skd0wnrkssfcvrn6.png)image.png

05.数组

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bidec0ur0kmj1onfgemd1han.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tcvyubyqwjpl3s5qkjfisqzv.png)image.png

06.函数基本使用

函数的基本使用

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ecp831oud5uvedalmninbywc.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/u5ys6mgvvyixp0v2gkpyqtrq.png)image.png

07.函数完整写法

函数的完整写法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/boi2vvllwwdeernrpqof8wel.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tzu0wbverum30sap7lcdtr1v.png)image.png

08.箭头函数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z2cbugcs3092kr85ddkp2lvy.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g1v2xkwxrvqtm2o0olyltn9a.png)image.png

箭头前:参数部分

  • **参数列表**:箭头前的部分是箭头函数的参数列表,用来接收传入的值。

    • 如果没有参数,写成空括号 `()`

    • 如果只有一个参数,可以省略括号。

    • 如果有多个参数,需要用逗号分隔并用括号括起来 `()`

箭头后:函数体部分

  • **函数体**:箭头后的部分是箭头函数的具体实现部分。

    • 如果函数体是单一表达式,可以直接写表达式的值,省略大括号 `{}``return`,该表达式的值会作为返回值。

    • 如果函数体是多行代码,需要用大括号 `{}` 包裹,并显式使用 `return` 返回结果。

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jq6nly3a7zfnw42vxxqcxaga.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bk2gke91xsu9ugbqqrkniggl.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/usz382u9jqqkwlqlzcm1ydsg.png)image.png

09.接口&对象

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/spksddjz9isa4owke9xlk98p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vg2bj3y7ct3f184zu21pzj39.png)image.png

10.对象方法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oihw5cf7po7obuf6j7ftepcg.png)image.png

11.联合类型

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/w9aa5fd2e92dg158aivz4gjq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qcr5be4cuupch8kcso3fypah.png)image.png

12.枚举类型

引入枚举类型

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/eewh329z7hpfpfq9rxkj39co.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tvmc442bunevqcao71n2oe45.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lr5r8e8lrn1zvmitlq63eloz.png)image.png

ArkUI

主题 14.界面布局思路

界面开发-布局思路

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oplimum4a2w2ac8rjyvc20xe.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pv0xmbb9vt4a6zdgg1wwsb8i.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hbcm3b6icwd56h3h2dlscdk7.png)image.png

15.组件属性细节

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/onjzjna8aeemenuegwyvfui1.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/okyk9ecspi80u4psrdqq73qd.png)image.png

16.文本颜色

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/uc0nfshcza6c4900ir2mjnnn.png)image.png

17.文字溢出

文字溢出省略号、行高

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wq066whd0w52fk3zzee90itw.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/w86zn3u0o3he4r28c7p60fn1.png)image.png

18.图片组件

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/t09m1qkzr0eczmfllu7crzle.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nehuafcuance4awjqg33iw2g.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sznjywj6in1qhlmdku9cv3ew.png)image.png

19.输入框和按钮

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gskg7kvkv0r3d2cm4ci92w5v.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wxoljnp5mck7l3ki604tfa6w.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rvkhqvnya2k7iatc45bjnws0.png)image.png

20.华为登录实战

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/smhpfwy6f4gl93xg8dxtndzl.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rralbpxgxfi6wvtpqrov06jh.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/w8kilao3up5md8bu70mofn17.png)image.png

主题 21.设计资源svg

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ph77d4l0edc7mzst1lhqad4y.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vgscvdvp4bfia3ukbhqm0tlj.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oafg5d90y09v1uvzkettxk9z.png)image.png

22.内边距padding

布局元素组成&内边距padding

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/a5ce2a0ryx9krnot7lg2qiz9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rzdrs8pwlbfnlghp8o3jn9k3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jzhk7pm5pj7ctkij9by6ur15.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ehgqq8hma69d2z2048ojf7zs.png)image.png

23.外边距margin

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xw28abk92csyqlk4k7zz54g9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vz96cbe32skwqxcbvkngw8bu.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xj7t3vvf4zghowweob2sayrx.png)image.png

24.QQ音乐登录

综合:QQ音乐登录

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/poz1dg5xqsdek14o8cbubdil.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wlw685ri2q5eshlpzcr84te2.png)image.png

主题 25.边框border

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ak4ir4esgs5wzrhk9hxgbs9b.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/n6huihu4m2hmy4tv3nmcppvf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tm0idibfordohjsb6sf1ae7o.png)image.png

主题 26.设置组件圆角

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qf25kw43xsn7y9bmfw9jk6ma.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/exoyzkw0wvp73kszpri56lk1.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/awy02sred5z35c69rbvgjatp.png)image.png

主题 27.特殊形状圆角

特殊形状圆角设置

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gvwq5tszydzvzqsetltk0q4b.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ycb9gozsrnfznyo4b80lv9m9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tssewpvn7wd5dvqge0ymu2ii.png)image.png

背景属性

主题 28.背景图片

背景属性-背景图片

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qbhc45l0v5h846avcpf9cyt2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/crmzqnmuzrl6qcken1y4nck6.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/irn0r3c7srtcvtupdzxyjk99.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g9ayix5djanneghk4r8mcidf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sc9pav55ry28i2hl01n8ozm7.png)image.png

主题 29.背景位置

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tee26yczjab2k2bxrslmn6d0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/m6c2jgpdmb3zcxad4dk6l09x.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gtb1jujy3yz1hu6wcll46qxg.png)image.png

主题 30.背景定位单位

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kduvw2g10l019vitvpf3isi0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dmvtuukdirjr4wbf2c18i3x1.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nvf0uj0pyh7upejjevxbj86g.png)image.png

主题 31.背景尺寸大小

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yvoxfuaexi13sfnqygrrhobh.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zabotgxtjmkyb3ezdoqw5zr8.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j92z767px7fo3g7ugnbs25lg.png)image.png

线性布局

主题 32.主轴对齐方式

线性布局-主轴对其方式

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rlbsail7d9ue81ql5ahondb0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bhvgvwn5cl6wuaz7vn3qgv1b.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/s1ckjtreer3mkg3rtev1ykap.png)image.png

33.案例-个人中心

综合案例-个人中心

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/enmjskz17cpd1zrv3zjjbias.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kz0db1c7olsl7sa9866phxfz.png)image.png

主题 34.交叉轴对齐

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gpm9rfdoxolmmshzsbk0o8rg.png)image.png

column

// Column的交叉轴的对齐方式(水平往右的交叉轴)HorizontalAlign
// .alignItems(HorizontalAlign.Center) Star Center End

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/uppohigpvt9vayzwd0y48d4a.png)image.png

row

// Row的交叉轴的对齐方式(垂直往下的交叉轴)VerticalAlign
// alignItems(VerticalAlign.Top) Center Bottom

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kkz7eapya6ove3x4yuee460p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x0vniyvdz6q4ndr464bd6c65.png)image.png

35.案例-得物列表

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/n4anwbapxx7fmgbrwv94c77z.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/i3bm82n1ycf90z4250dkvikg.png)image.png

主题 36.自适应伸缩

layoutWeight

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fexbq5f20bjohjfgnp1vbwvn.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lhboddv4toc004z6ho3o9m3j.png)image.png

37.案例-得物卡片

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/crh05esazefrygyxdliid9bk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ntp5m0kfb300hgeqq3e3b56n.png)image.png

38.案例-京东登录

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/uqykp2c25m2ddvdkzw37mbpc.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lq0ok64bk0qlxem9ox1ck2rp.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zkipqopnnetno6dlrej499tk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qpuwuig75zrznrpj3ul5blma.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wd26gszx6s65arauz7p74s4u.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/p6x57hc6234s1jjkihna7fqj.png)image.png

主题 39.弹性布局Flex

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/flbh02brv2doaowpvl3pumd9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/a1p9emspe7110d9kr1ortzo2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mubx4anp6xkfmjes8yvve5m0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pjcszumxgrjhkhpdyt1f466x.png)image.png

39.案例wrap

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jtp8s4bl0twyl56dmvcl3il9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/doqcftbld6hkm1kggomovbnz.png)image.png

40.绝对定位

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cd53fbl0ph9468fyyrm0syq6.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v5le3sk2uq8fv055kkagq3xm.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r5vj7kjyyzwl1a078dxcrptr.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nwgz5t8kdx8c093monp3n4jp.png)image.png

41.人气卡片案例

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v446xn7s2g2fjxrehi1cxsqe.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kgdbw6lww8oat6e69hcybjva.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ot2u2gojc2iwf19gjlws56xr.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ekgvgud3edb3yqbp3hazfho2.png)image.png

42.层叠布局

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qjiwzomaetrhtwd362cfyo4n.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/onip2l7odch30348k1uuu662.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/erfow812ek833dcrqscx6cv0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/m4h3c4kewbt1sdr0t3wi7efs.png)image.png

43.案例-视频卡片

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/q42t2km2s0en0lwh4jgcd7sy.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x0xt2r4l296u40lph6njdb8d.png)image.png

44.1综合-支付宝

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ccbubdqpu7a39edminh376u3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/obyph28gnonf4jr2y70lo809.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vdiav3x7yy8ybvtnr58br1xf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bcaalpxc12y50gqv70f5zwrq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x0jdduagqnwccsvp6lb9xa2s.png)image.png

45.2综合-支付宝

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lci50wc730pcize2exr0djzw.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dzg08ab9jiydjozptob83pui.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ymetjnrf7vp2hb3r4klf8wfo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z3m4v0341x9nt0tkaeuloj6c.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xio2ufmio9bxqeqt540fss88.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r5hcggozo11l5fha4uyixtp5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g08vcs4qvp70u8jxhnwilqo8.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l53aoclohuun2ntouhm17716.png)image.png

46.字符串拼接

和模板字符串

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/udy1rh6s2dtpwget22m7052t.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r9r16rnwhtl6b7ptm1gq4zzm.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/y828jpqsqy3jqwsdchxkcxof.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bs18sorhtiru90gtvcfq9ow7.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dpjcbe83dsu9t7mhpd6k3og1.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/m2pel2mkn7urkz6s9ejdoweo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/puiw8qcpi7cge678lrg21j3w.png)image.png

47.类型转换
  1. 字符串转数字

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ydcvg0h4hus0etzf6jjcanyq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/an77ubov6phfovpka45n0up5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l75dt0v37zmeczokp2uthglq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/t9t9x0c55sftu8b4ubmdeogl.png)image.png

  1. 数字转字符串

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ogx0z1g0pq6zwljk1i4q3evx.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tiqtla1ir1tusdvi9mkfx2k7.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vj0caqodq9kaldhpma4fajox.png)image.png

48.交互-点击事件

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/twfg5dsl80lw95v7mi8c4y50.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bmihbv7g1nqymg52jl091nmr.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hju0paw2rfxdriih1zmx76yy.png)image.png

49.状态管理

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/o0spsius377d67a3s33smipv.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/q0t6eejgnwox7st8kr56mfwb.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/thp2ei1sfn1ouoxew6xjj8pj.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/c0v2bnlizlthm91f4mglwdi9.png)image.png

50.计数器案例

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bhih8olr6cx7rdyqdwyngaq0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dc0okudj4rikfafc5hd1qrj4.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/f0x2wfdppmrmo09e2r4pzu3o.png)image.png

51.运算符

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tdmh4i9ezb4n13btolv1z4oz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ru050k1b3hknouffps4t8vrt.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/n093vc1zdcg9r7458nuzq1rs.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/s418iwe7hvcbklgfvr41bv5p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/iwpg1zyae2nz8zqb80ry3fgt.png)image.png

52.案例-点赞增加

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dgh7kmja3iwwn4xq4xfkjtar.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fzg6btq35lru5znpgjv4hcye.png)image.png

53.1一元-运算符

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/br4kc4dzskm202ylgo13r1rq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cq042ug62dayuz69cc89dwmn.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z7cnkjiqk3p0yhmogc3aygap.png)image.png

53.2比较-运算符

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bbwgzogeyizl31kklibolvnn.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rxnfor5nenlylsbre2l7kxfm.png)image.png

53.3逻辑-运算符

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r68dv6gtpddgxltum2j8a295.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fusonq3uoqvy7bnq9363hrek.png)image.png

54.运算符优先级

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dcbt5iidyxl9gtz7z2ymo1sv.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/obwbo4li96o660hznxlqp40a.png)image.png

55.案例-美团购物

这个案例代码是复制的

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nactx39nmfy32e8z5ozmgcn9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dstoh7unhbaxxsvqicpxan4x.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xy9xab4dja5h6ssvz5hg4ugq.png)image.png

**修改成状态变量**

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mzwodxdf859quitdexnznp99.png)image.png

56.数组操作增删

数组操作-增加删除替换

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/b90h4k3drnphhy5ewxndnaxt.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tvq0csqkcho6pf4f8lukt1j4.png)image.png

**增加数组元素**

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/if6fbbpbac0h884vh6b92ycl.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/enylf91avxn0e6voduohc58m.png)image.png

开头 (S): unshift (开头增) shift (开头删)

结尾 (P): push (结尾增) pop (结尾删)

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/er0hc1ez3gz9r5pufxd3kfie.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/runxv528jwu5vjq2cmf4vg2p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yzpxjynozcxuly92wg20vqd3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kdr3x7yd7yfekgnt9mtp0fmn.png)image.png

57.if,else语句

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xi1n38o2v3kykby739600u3q.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/py7929inuo3uda1l49a2u9s3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/w9lqpg27xpulh1fsyfhc2tqi.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ezaz4kir6r2hsdkp56id780l.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/b4uzhv5ky0m4l76xef5t0o53.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ck4f0o3sgmgxhl2rqohp6gpy.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qvid6yqo9ni51c8evie8ku1f.png)image.png

58.if多分支

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vgmecqwwooor78e4td14d8vf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lvtaprq34pirapu390prp621.png)image.png

59.switch-多分支

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vwt3wd1rektnb83is3ghnh83.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dw7st73hrjv5c5yygetwa92u.png)image.png

60三元条件表达式

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/k1lsjjmp567rpt7a62sf4lca.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/aeup7vof1kwfjwsej3a7w8l1.png)image.png

61.条件渲染

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r7aylpvs9w06nk64heq17uep.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/n01ft3eatyfrl4f430w3u1b5.png)image.png

61.京东加购 61.条件渲染

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zl1bz7jc3og4j8bhemaps79r.png)image.png

62循环语句while

62-while语句 & 三个练习

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sb9pmu7wwjut7q38arr4bqlq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cbjici6l5buv8yajsfwzqlcu.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dm3lyrkfdepkwmdavzhbf1g1.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/t3p9zehm8k9y27ubhkwlf2em.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ennfmsfuuk4pm4lytnkl8wpv.png)image.png

63循环语句for

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/h95egsw52qwzeireepznhalq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/b1ajd7nlqfv6ae1rhxauxkxa.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/a53osp7clhcbosfa7400a95x.png)image.png

64退出循环

break和continue

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oiej1yr12g6nb2aksr6dirux.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jpkagks2hufn33j17jg7ur9a.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/m6ngxycz2hhy85m2l924154n.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pw2fujg9dql7dxue8llabffv.png)image.png

// for中加if, if后面不用加 { }

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jomvd1e6jvv7h3kx0ny6lme6.png)image.png

65.遍历数组

for 和 for of

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nwrpktz0mrouxvxgdobfmzvc.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yxdvd8kdmvdvozznyigmjlg2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hbfineyfkvbejhn8050ko0f7.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ec1t3qclf6mluwbxhwbwnq6h.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j91bb1lvhwijo0139flqmd31.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v7h72p4azajs5n2s9hthe8rc.png)image.png

加入新数组,数组名.push( 变量 )

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qu49uic5us5hb02reh0dly66.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/os8zz5x8kwof6qrdq54hqywm.png)image.png

66.对象数组

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ca4wgx3rwxzakdanz1rzvbpz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/e048vplcupih318zkx9e6r9u.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ome2w91tidy9f2qryhlfsagh.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v91b9ytwctr9ttwp7v8ml8h7.png)image.png

67.ForEach渲染

ForEach渲染控制

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vkmieprcu9mnmta5ewpcjd5n.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/q024p8wtykwtisf62wd6dbq7.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fwzulmg174a81cfjgmrtew2e.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jmbwo4jqpjga70indtniu27h.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/u024jgtlfmva8yl6vnwgsans.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jwwxz5c5wveb9piskn1dg6lq.png)image.png

抽卡

68.抽卡-badge组件

8.![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/li9oxnlmhqfwou1m1cq65wsy.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cu0jep4il92q9apl019kfz9l.png)image.png

69.抽卡-Grid布局

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dhl573gfetqrqc92etsey5r3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z1xbbcnqfbx84dxazobnyhwu.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pfagq9pxg1j9b3wxqisytxj2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/w851j7y6jmgrgjf80fjfd38m.png)image.png

70.抽卡-数据渲染

数据动态渲染

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/no8tqz23hye9j2lvqw4adghz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hrociryukjx68r0kz5obn48p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/eu7o4i85vtjflqgn7ntewpky.png)image.png

效果

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oczeudowswu475u7dy2e6r9p.png)image.png

71.抽卡-遮罩动画

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rdpxaavg2413nlxxs11438un.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/f907fhoe09i687cqppbcy4h3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ijo05y74otyb342cajdvraoa.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cz4lxc2v6btopbqp2g36lmao.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/b0q79o835hcre3ogv65ldxn5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yg35xil065pdng3izsy1ym8e.png)image.png

动画是加在后面显示的那个层级上

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sx438i7go121x6lpibqsi9gm.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v1g1sbb4k9p0m3sl5hzum191.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pn20g5d6mnp8va4ugkqfcxm0.png)image.png

72.抽卡-随机卡片

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dfpegfwbq344wuutdfr2wmzu.png)image.png

得到0-5的一个随机整数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/o6wo3rtoc8ubiyn649i7vgdl.png)image.png

`Math.floor`是一个内置的JavaScript函数,用于返回小于或等于一个给定数字的最大整数。这意味着,无论你传入什么数字,`Math.floor`都会将其向下舍入到最接近的整数。

数轴的右边

例如:

  • `Math.floor(3.7)` 将返回 `3`

  • `Math.floor(-1.2)` 将返回 `-2`

定义一个随机数的状态变量

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hmy5ehs8qk36gbr4yp5xq4jp.png)image.png

用数字代替图片

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/uuaytc4hahlhom90qokryv6z.png)image.png

用随机数

floor向下取整,舍去小数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yv2lwjafehooy2a2jnodo3lk.png)image.png

73.抽卡-显隐控制

大奖结构和显隐控制

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/otlzptlqqlqg4wmhu0s54hmb.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vkyr62y80mn18ruha10erbsk.png)image.png

如何判断?卡片的右上角如果是否为0,不为零则出现

用boolean,定义一个变量,默认false不显示,不为零则true显示

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/si5ufo2o7uqta05kpqltpdqu.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ied3hqbebeimw1lvf0mq8n78.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tsgda3tr4jxcraonfvi4ofpk.png)image.png

74.抽卡-再来一次

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g66cl9unitf4pglrsrx5xvei.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rhblw67tqmdvix5b867gycpn.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hc4fjjh2jzr23y5v77qyjmmc.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/k83pktn0g7ux1cgyjhotjqhm.png)image.png

再来一次

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mw4afnaisftm0nghtcaoi0uk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ciywz0ksdhjpceyh4kqwvd1y.png)image.png

75.swiper轮播

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ioamhz4ovxy3cfsjni83dlnk.png)image.png

  1. swiper基本用法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/h9hg0t8ealx4nqqci4289i22.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qo4f8tpbrk671w0m69s5atbm.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/aggdt6z65sfycpmetdlj6rwd.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/c4ikj20oslzcq1dz7z45ws52.png)image.png

  1. swiper常见属性

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/b9h787yyolw0ptmp8ktsnz0r.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v321mqpjptzw1jlua79nfhjr.png)image.png

  1. swiper样式自定义

indicator :指示器

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ffpyrr2lw9wssu4howvjfnxl.png)image.png

问题

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cp3h1pmq79i2xqj9b8z0y574.png)image.png

这种图片固定宽高的就不把width、height定死

设置一个宽100%,

然后用aspectdatio存好图片比例

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l6jbx7s62cdh5ovnr0mic4j0.png)image.png

76.样式&结构重用

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ge60t651eqb8926i3mvakdor.png)image.png

76.1Extend

复用该组件内的重复代码

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kcp2adzeuwncp29wclyjcue5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cx02ix4ysojshcszrzrd7qua.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hqv01nik5h3i0pbpj9rlqr0y.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qqynqzm6y9o2ps2t8um3866h.png)image.png

76.2Styles

Styles: 抽取通用属性、事件

适用范围:当是不同的组件时,无法用Extend复用,这时用Styles 抽取通用属性、事件

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tw05lq4eoln84x2jp45u1ap9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yquhvxpm1dj9mh65kjsq0ep0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l67mix4oda3fco501lfuhwpa.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/u38t0vy0uh44js8r64htmecg.png)image.png

76.3Buolder

Buolder: 自定义构建函数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nxk8hh1jk9qxfp4bubwl42s7.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hm0c42nwvjum4hqaqvfnmk9y.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kj6m278dwo994co77uh6rwot.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hqy2gtgl8f5349u2xsx6mdad.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xkmfvurit4als9pckruc4ko3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wpz711a7ini35ycqatpnavo0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/in2psx3ddijfddyswhguzkbg.png)image.png

77.scroll用法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j199ort6ahev3e0hex395im3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wfcx6ikgzgk43swgp2lsayv6.png)image.png
![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/stjl9noheo58r4sy3nc7s3ih.png)image.png

78scroll常见属性

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/t5hm4t1zaltgpsxjk8tedq3l.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ibrnzmx959b233lx0cobsu6a.png)image.png

79.scroll控制器

快速滑动到顶部、底部

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ulpbc2etcy89p5vfi1m5x8rm.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bqwhj46k02hq6dm0lf9pjxrh.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/m2kmddjbktwx36jzdfg41q7m.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pl8vir4sia7uf5t08xpe54d4.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oyk20o1iv80l2cnc8623gq05.png)image.png

[![scroll控制器.gif](https://www.helloimg.com/i/2024/12/20/676463311fcc7.gif)scroll控制器.gif](https://www.helloimg.com/i/2024/12/20/676463311fcc7.gif)

80.scroll事件

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/da9xhvetkq91k9au2fz8ozbl.png)image.png

主题 80.新词

currentOffset:当前偏移量,

[current](audio:current): 当前的,

[Offset](audio:Offset):记忆

[attribute](audio:attribute):属性

willScroll

点击scroll组件滑动时,返回移动的值

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oci9an3m8g2reoahtx5zzoln.png)image.png

[![onWillScroll.gif](https://www.helloimg.com/i/2024/12/20/67651fa3e7fc6.gif)onWillScroll.gif](https://www.helloimg.com/i/2024/12/20/67651fa3e7fc6.gif)

80.京东案例

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pqs7ffv3pe7uuemdwacw28z3.png)image.png

  1. 点击火箭回顶部

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bzp94ig5ivpiwaqz4iedym0v.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/f466curj8c4bcy1klnm6qm9z.png)image.png

  1. 显示效果切换

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ety0b0qham27z58z7zl3zlue.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hjwdfr8y5n1mybhf1ot49vx8.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hbo4kbgf0c2nc2k0cmuya5mx.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sogpmv6g34ws74zqgpms7p3f.png)image.png

81.Tabs
  1. 基本使用

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ynj8jue7zyd11z15uak1asm2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sqlet7y724gdwff8r5z7dxnh.png)image.png![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/es0sb5te5dmtyxyt4r6xvurv.png)image.png

  1. 常用属性

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tlhifo90s08261h0yp172ftg.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z7i4u14g839895gsub3bri90.png)image.png

  1. 滚动导航栏

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ylfwmi61tkz5jyaxnowfq0ip.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x3a4fj2xegzrn2ulw6f15z4a.png)image.png

主题 81.新词

[vertical](audio:vertical):垂直的;纵向的

[scrollable](audio:scrollable):可滚动的

82.自定义TabBar1
  • 基础结构

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xwyn3ikdukdx7gu9860nlgfz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bq16yde52fnkkmxte53cowd9.png)image.png

用this访问定义的结构用作导航栏显示。

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wb8iin6f7s7qkzsjdyk6ii1t.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/h8winrwdlct6ffbl58tqkpli.png)image.png

83.自定义TabBar2
  • 高亮切换

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ltg8806jajr0v58axdiqrmu8.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rs4o77jwicx9os51pwxx26kd.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lo0k8zu6slg3k4sf8mrjwb3d.png)image.png

![导航栏高亮.gif](https://www.helloimg.com/i/2024/12/22/6767de39e2535.gif)导航栏高亮.gif

84.小米有品案例

可以复用前面的,就改下中间,加个@Builder ,TabContent.tabBar用一张图就好

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pr0u3b3iim77s4jrfb22akrz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xmomysw1zh21c17xw65vysy6.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kqnlxz6cmyvxx52veh9yb1cw.png)image.png

class

85.class实例属性

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/eiwzh7ovon6xxf0bd6ywi4rc.png)image.png![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nppejkjlo30eatb1dshx9840.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xu73tks3kqqsw4prlgyvbiri.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tu2vibrz3mobsp0228bhd06t.png)image.png

85.「?.」

可选链操作符

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/o3m0cuk0drbi8mdhw97bt1p3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/u4cdkebsbzgl7l2n40b2rb8x.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sp74bgqdemukadce9rbc8b58.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/i8bhby4iepah16yggpvrh1t8.png)image.png

85.「_?_a_:_b_」

对同一类型元素进行二选一,

满足执行a,不满足执行b

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ihiwrxq7m8hzv2ry78xf4vni.png)image.png

86.class构造函数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/u76jwbkcjukwvvi7pyzyekvn.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/d57v3qmw5rhadpk4u1gcnsqn.png)image.png![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fh20h5mpcmx3c2ceydtgu4ps.png)image.png

  • 如果遇到参数比较复杂的,可以把参数合并到一整个对象里,

  • 基于接口传一整个对象,然后接口调用

  • 调用接口可以不用按顺序

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/amovpf55b31jo9yklwswkxem.png)image.png![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wzfhowdpkdtsnfxzz1pmeqp2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/y2c5ohyov9rk6p8yuqb6o9p7.png)image.png

87.class定义方法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/onadue0ptefmaog1ekdzdme2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/afz4q8j4jhj4wthjqelj2bcq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x36dvyxtdg260v55runa5e8k.png)image.png![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/i90i4d6gb8hntk9sxom14uru.png)image.png

87class静态属性

假如你不使用 `static`,方法就会变成实例方法,必须创建对象后才能调用,比如上面需要创建p1

相比之下,静态方法更简单快捷,不需要实例化就可以调用

应用场景:存版本号、工具方法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wke089gycnxc6nb6thbbcedo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/f26cqm0xok7jvslogy1b9z9c.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kzn1906w7r1ik063zbzdwczk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v6ozpb84zcz26d1gubsocndb.png)image.png

88.class-继承

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/e4pw5h9q2wq9lln5h3e1ju4d.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kl4k40848xge17cq0yss9ps9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lilbg5jj5i27mpknev7mgbgs.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/giyl8fx1ujwx3t3622rypnml.png)image.png

问题:如何调用父类构造函数?

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tk20rorf5q9e7i6v10a7b6ey.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/i96d127rzekg8p46ybquiy79.png)image.png

如果调用了父类的方法,那么后面重写的方法不会生效,这里s1.sayHi不生效

89.class检测实例

运算符instanceof

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/q1uao6ik553obdaiwtt8lbz0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ijm04vds2bx78fy96x8eiemw.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l9v0rp1ax76z68l0z8zdokif.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l3gq3n3xlltjpzw3u9faljij.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/saz9yhettixr9f89iksnx8jr.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g6bhlj31dprzpea9qzel5pfx.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lkqajyz8ou84wtwji8ea9mi3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/krza8kolc0eqhqpiaqmhc2w5.png)image.png

90.class修饰符限制访问

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/db7v43owfy96pjum4hg9jlsk.png)image.png

90.class-readonly

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fjsnxew6lnug04v0teffd6xq.png)image.png

readonly:只可以取值,不可以修改

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/evl7prsy5izaeq3mfxjkc4q2.png)image.png

只能读不能改

90.class-private

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wnngjg5ypyuaaiebdtbuijy1.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jtkmsh2j1iqk5h0v1z4vo9be.png)image.png

90.class-protected

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gl40oojf602fjieozb2bcu7y.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dsz87kmd38ngnxe4jk1be2l6.png)image.png

90.class-public

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dk9mntcrozdr7szb3e8lmh7c.png)image.png

91.剩余参数和展开运算符

剩余参数...

应用场景:参数可以是不固定的

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ea9irlvnm8j6d1bt9qccikqf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/c5gfnwnj1flvwoupwje9pxp8.png)image.png

展开运算符

应用场景:把两个数组合并到一起

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l53wq6jdh73apc09vhl427yz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/p0gnunpe9ue21wm22fddobjo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ppz38wgqizja5n1cv9p21imh.png)image.png

92.接口的继承

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z4bzbq97tf479b3gkq5ke9ha.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z8uomh9nf8i9ejriymymahg6.png)image.png

接口实现

92.接口的实现

可以通过接口结合implements 来限制 类 必须要有 某些属性 和 方法

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xg6f9td2a1rcxgtu9dytrsgi.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/acmt6fafts0ipv4z5rhml5i7.png)image.png

泛型

93.1泛型函数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/efcfa6kkj8kte7nh5b3iyeub.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mir2ehuvunw0z138d1zejp75.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/plxfi2kfcy3sx6v3a7ef9f7h.png)image.png

主题 93.新词

[param](audio:param):参数

93.2泛型约束

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g31bgmepb0va04xx4fgr1erz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/q1askkaiu4gndttic3y8y65p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sjqionqwbx8xcv3qgkx2pytg.png)image.png

93.3多个泛型参数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zuj38ju1f25xhk0q3s2wrcod.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/s0yzqflpuzinvmjmzs1jyoq6.png)image.png

94.1泛型接口

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rixk58ji7ubhfmzp41gickg9.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ubup8uctqor1zl81so1s1wwk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/c98pio7i7k7uzfrmgrzarmwi.png)image.png

94.2泛型类

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/leqse7ae8auoaj7z1ap44o2p.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pdl4ud1nawxlxi5yaxumgz7e.png)image.png

模块化

主题 95.新词

[export](audio:export) default

[default](audio:default): 默认

95.1默认导入导出

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ldwq6dkchgeje982q97d82ey.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bnihlmqanv0s3ced8gpyj9ma.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ckzna6wx4ak3s434wo6ziqru.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/d25uf2e9d5eblqd41wm5b11b.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/n3cj2seti5bnieo1jfcxxawx.png)image.png

tools这里

新建目录 → 新建ArkTS File

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x658b2y61o77mhl52arhl20h.png)image.png

95.2按需导入导出

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kz2qh9fxmqwfe00iojohdchi.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/i0kprn3ayo44oiajmyxr6jwc.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j68ffiwewgbwu3ic0gr8j52h.png)image.png

95.3全部导入

需求:如果特别多,几十个,一个一个写值名太麻烦,如何简单点?

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mox1gxm5eye1sl65two1gojk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/p52njbaz1cb8mjhy6d2l44sy.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/otmivicak4oe20irhqy1gf09.png)image.png

自定义组件

96.自定义组件基础

把一个一个页面拆分成一个一个的自定义组件,可维护性、逻辑性会更强

  • 一个ets文件只能有一个@Entry

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fxv46vt2vbcjqq8dvkfrnbgx.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/znmqossa5uuae7uspjs8sgjz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/c8jd5286162z2ad42wh44s1d.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/xkaubd5m12y9v01m09x60xiq.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ojxt5iitxseec7ec2iftck9d.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ie5r35v1wgrnzgttvktqr72q.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/eswn67hp4l02rltwahhn3wnz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j82cpxl6yiu6lpxy5twglybz.png)image.png

97.自定义-通用样式事件

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r1d94itg93wohd1t58gstoyg.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/byqxbq9eqsdw1am400mqixxt.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pszoaafr104pu3x0m383tlpp.png)image.png

98.自定义-成员变量和成员函数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ydhc86h1ftkubgqpkj9561jl.png)image.png

[Panel](audio:Panel): 面板

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/je5qr2j53k0gimv39ce3jf23.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r56macj84rz229rg04137oc5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gr85lgnw20jfa0f0jql7btdn.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mtu38zlh3owivsuwao68r4gv.png)image.png

99.BuilderParam构建函数-传递UI

param:参数

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tynm082p02znbk2h430okls4.png)image.png

  • @Builder装饰的函数也称为“自定义构建函数”。

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tngj08sbh8jvral8w5sd0eam.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/elvq7o6gbm8mrs7vawfwhj26.png)image.png

99.小米有品两面板 99.BuilderParam构建函数-传递UI

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fbheen1al4my6dvnzgzegwrk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/w7pyvbh1wmyi7i2whw0t0qm5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bodq901wvyej4g0l9mgh7h2r.png)image.png

后面加,可以称之为:尾部闭包

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/wqescivw8nht98in9bnvkaob.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/oq7zfrgvjg7n4hm39v2aueqm.png)image.png

100.多个BuilderParam

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ssc2fofs5urctypvdzxra0yf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kowgxquv05fnhvb77voqod9v.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nxgheqc44j8gh2asvq9nzk7x.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/mj6yo61xnazgb2krh54samxe.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z0gbf3cr8nokns5jjoee1lpu.png)image.png

状态管理

101.状态管理-@state补充

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/r8im0kr9q1c7sok70ndtada2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pmr01tc8tdt5eeybsse8hge3.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ejz6xcrbbwk0ul7zwitgoi2f.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/i5xhof7m69pq5ra0a121dqdz.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zliicb545x82rqq2l1yimm0w.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/gmhzcv45txyy5vccoa7yfltw.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v20mbeacx3xtv3plpq83fe6e.png)image.png

102.@prop-父向子单向传递
  • 在子组件中写@prop,这样就和父组件建立了通道

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/x96jzqzx6u6kj5c8aeh06w7a.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sg4kix1gv44juym5ncslytjo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vls9xxp3v5t2d960y36s7t0f.png)image.png

[![@prop父传子.gif](https://www.helloimg.com/i/2025/01/07/677cfb76aebf0.gif)@prop父传子.gif](https://www.helloimg.com/i/2025/01/07/677cfb76aebf0.gif)

103.数字加减

[![自定义组件-父子组件传递-数字加减.gif](https://www.helloimg.com/i/2025/01/08/677d689958395.gif)自定义组件-父子组件传递-数字加减.gif](https://www.helloimg.com/i/2025/01/08/677d689958395.gif)

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/a4jd0pxgvvgas3celobqj6hi.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/il5l8k6jglxnb1t35nuf5rrv.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vlqag9qv8qdo0frinuas7ao8.png)image.png

掘金评论

主题 掘金评论效果

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/qvolyieasqlbe9rawpbl8e5x.png)image.png

104.掘金-头部

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zk5wwpv77srj9jyhyhlo1cm7.png)image.png

index页

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hifjg4lxatdhxd8kvgfkq8mq.png)image.png

拆开的自定义的头部组件:

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z5pemilk46ab06lh9wdugx97.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/m1i4jm1u6a158b99d4ss0gl3.png)image.png

105.list列表组件

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zqspc40bg7nkmmd4xh73ctog.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j7z2orjbx2ntlodsox28so3i.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lgjdpdue15p2g3trzanjg36s.png)image.png

主题 105.新词

[divider](audio:divider):分隔物

[stroke](audio:stroke)轻挪

106.掘金-评论列表

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ixf72x44v3i1jx5zdztk8rmx.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hlzka6hehpp4xtffepumyyu5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/zdoul7t6gvkoyj1fp8rda8pj.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dvc0u7m7ttxoouvgqn5ap31e.png)image.png

107.iconont注册字体

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/z48vz49szthig948lxj7mt8z.png)image.png

图标注册成字体就可以用字体的属性来修改,比如颜色,字体粗细

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/q0tablfj9oxmqefdr32vv8f4.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l6jiqf2nboaigbzk3gjmyg4f.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v6mpet1tok2j21v3fm3vppes.png)image.png

108.掘金-底部

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vsssjj3muy4222hdvn5y2yxg.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/pf1bf3enyams979xgxetexu4.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v42nh4o132ymermfgscrvvmr.png)image.png

109110.掘金-数据准备

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/l6z1tpacgifhr54a81u2x9sk.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/g6v5l7apnpecuhm1ajtsoumo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/d61bz0pq5rnp3pru5olb4d9f.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ip6dhx7rluc7og8nmc8y49o2.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/a6jvsbjxkxetnl1kf662ug1t.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hi27jvkyzlwtvf6gj5st3r2d.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/tvy5wux1bevfhp2apf4zvgru.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yohpljifxyi4pk01ls8mnq41.png)image.png

主题 109.新词

[Timestamp](audio:Timestamp): 时间戳

[current](audio:current): 现在的

[convert](audio:convert): 转换

110.列表渲染

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/sra2ty5brsec6t1g9f50tsck.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/j5dkjdas3be59f8r9q4ytw41.png)image.png

111.点赞功能

点击+1数字图标变颜色,再点击变回原来的

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jhoh71dkg5m0fshstc3yrkwf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bt03pnc2c8ad5p966nohe3ei.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/moy1cnbifd0q3hy5nl2zigd1.png)image.png

112.添加评论

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/bk6w1zc8r4oimjhigft9dkxz.png)image.png

  • 构造函数中多个类型顺序有要求

提供的数组中的元素顺序需要和constructor中的顺序一 一对应,不然会异常

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fhkiyxodh0zc11avfvu2qtrj.png)image.png![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ajfk5bgkaeraj2gj64xhh24d.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/lqi9wk9ey9d6bzfo2grt22m5.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/izvnprzmvus7ees758wf2hug.png)image.png

113.排序功能

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ed2sofdfdrq52d4u74ru8you.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/h0c3zkjhucw183wtppo8v3ym.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hkjx4vquv7r1lrlqn233xq4g.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/vreu8n1w9w3ev73rnioi6so0.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/cr2jjwuavi4o6mlxobw3vo72.png)image.png

组件传递拓展

114.@Link双向同步

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/buz3lbnkxztlbakvotihtwow.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/kvaevvvxmpu5b3ynjhk9fphl.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/o016l04lkjsnrn3im1l35wyj.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dt65gzw77x7w857z71ebs09q.png)image.png

115.@Provide和@Consume后代组件

推测任务

从「祖先组件的状态变量」到「后代组件的绑定状态」的推测

知识类型

联结模型

输入空间

**维度1**:祖先组件中通过@Provide声明的状态变量
**维度2**:后代组件中使用@Consume绑定的状态变量标识符

输出空间

**维度1**:后代组件中绑定的状态值
**维度2**:数据同步机制是否成功

映射关系

**描述1** 当祖先组件中的状态变量被@Provide装饰时,该变量会成为所有后代组件可访问的状态源。
**描述2** 后代组件通过@Consume绑定后,能够实时获取并反映祖先组件中状态变量的变化。
**描述3** 如果状态变量发生变化,后代组件中的绑定状态也会自动更新,实现双向数据同步。

具体应用

**例1** 在一个HarmonyOS应用中,祖先组件A通过@Provide提供了一个名为`count`的状态变量(初始值为0),后代组件B通过@Consume绑定了这个变量。当A中的`count`值变为5时,B中的绑定值也会自动更新为5。
**例2** 在另一个场景中,祖先组件X通过@Provide提供了一个布尔值`isVisible`(初始值为`true`),后代组件Y通过@Consume绑定了这个变量。当X将`isVisible`设置为`false`时,Y中的绑定值也会立即变为`false`,从而触发UI隐藏逻辑。

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nzrulrpe4t7lgxon4d9csjjy.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/p579rokypbwgif1tdfjrqmqd.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/dysqvg3fmsbtx80mg9x0gtjo.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/nlzmbyt3aqixqjfk6cdtfpbf.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ldkxhhk19x5dvujf4o4d3li0.png)image.png

116.@Oberved和@ObjectLink

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/yg8d11y3nkqsn0v4dqeierok.png)image.png

路由

主题 路由新词

[router](audio:router): 路由器

[appear](audio:appear): 出现、显现、呈现

117.路由

新建页面、页面跳转、后退

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/ey4pm5552kh8960pa3ct8lm7.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/k9x3rlsjzn8dcz620bsqi35b.png)image.png

replaceUrl 没动画

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hp11nj2cul9lmozi8bgp9kw8.png)image.png

118.路由-页面栈

应该是为了防止在使用返回时一直两个或几个页面循环,如果之前一直在两个或多个页面来回多次,就会累加,再用返回就会重走之前的累计跳转的页面,陷入几次循环

这里就需要用replaceUrl

辅助,1. 获取长度, 2. 清空页面栈

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/rofoq09dqtw3gv3ywekygdnp.png)image.png

119.路由模式和路由传参

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/v5wumfzx5cw2bthmu1735mlk.png)image.png

[![路由来回返回.gif](https://www.helloimg.com/i/2025/02/20/67b6eaaa6d5a3.gif)路由来回返回.gif](https://www.helloimg.com/i/2025/02/20/67b6eaaa6d5a3.gif)

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/jir33uhidjk9lypuhfa2c5ht.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/fx6iwhdwqf253dfngg1t1f5r.png)image.png

aboutToAppear():从一开始就执行

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/hc7j128vsgetmgvn1jvqs26r.png)image.png

![image.png](https://cdn.modevol.com/user/cl74ddttj0wzf01s52ib8emjc/images/y069h9h3wy0apewglxrvoppl.png)image.png

120.生命周期函数
02.鸿蒙笔记
姜帝屋的头像
创建于:2024-10-01
随记
讨论
媒体