00:00
呃,这一个compos API其他部分,那组合API常用的部分呢,咱们都已经说过了啊,我们先来看看这个其他部分里边的第一个叫沙和沙lo I。这个沙漏是什么意思呢?实际上是浅的意思。菜馅翻译回车。啊,是钱啊,钱的意思。Shallow。下楼啊。沙钱的意思,那什么意思呢?这有个钱的RA和这个钱的if。那沙漏只处理的对象内最外层属性的形式也就是什么呢?前显式,那内层呢,就不再处理了。那沙漏if呢?它只处理Y6的小式。不进行对象的什么呢?所以说接下来啊,咱们用代码的方式。去演示一下,看一看啊。好,我呢把之前咱们讲的if获取页面元素的这个代码文件保存一份。
01:05
新建一个目录吧,那这个就是12杠。Ref获取页面元素。嗯,这里边代码我们就不要了,来个VV3。那上面写着H2。这个是什么呢?Shall沙,Sha沙。和shall沙啊。那为了让大家看到这个效果呢?我在这儿先来一个set up。M1M2M23M4啊,但是我需要把这些数据呢都展示出来啊。那我就来个H3吧。
02:12
格式化一下啊。当然了,我需要四个数据嘛,所以说我就通。看啊。Me,通过什么呢的方式?然后呢,还有com的M2通过什么呢,沙lo shalllo shallow的方式去创建。还有constant m3,那就通过ref的方式去创建这个对象啊。再来一个cos的M4等于。这个是沙ref。啊,这块需要大家注意的是什么啊,我们有引入先引一下啊。这块需要大家注意的是一个什么问题呢?我们说relative的这种方式里边放的是对象,Ref的方式呢?Ref的方式里边放的是基本类型,当然它也可以放对象,但是ref如果放对象内一步呢,它会进行RA的处理,那现在呢,我们就来看看这四个对象啊,将来我去更新他们数据的时候,他们到底是属于深响应还是浅响应,或者深间池还是浅节池啊。
03:18
先给他来一个内幕吧。内幕叫做。哪里都名人。逗号再来一个A,来一个20。好,再来一个什么car吧。我也喜欢车。这个车的名字叫奔驰。车的颜色呢,开的啊。虽然说我也比较喜欢这个,算了,我还是喜欢红色吧啊。颜色在当今的这个社会上面,可能。愿谁喜欢谁喜欢吧。啊,我就换成。那我现在就把这些数据直接复制。格式化一下啊好。先打开页面吧,我们先来看看这个页面当中的效果啊,一刷新啊,这数据都有是不是。
04:05
那下一步呢,我就点击按钮更新数据,看看到底是。深度的这个响应式还是浅的响应式啊,到底哪些数据是深的?还是甜的啊。那在这边吧,来个H2吧。是更新数据啊。通过更新数据,大家可以观察有什么变化。我们可以总结出来哪些是深的,哪些是浅啊。阿,那我需要用到阿的这个方法了。那现在没有啊,没有就暴露出来呗,就说反馈出来啊。Update,等于。然后这里边儿我们无非就是更改。更改M1的数据。咔咔咔,四个更改,M2的,更改M3的,更改M4的啊。当然了,这M1的是通过。T的方式是吧。那下边这个呢,是通过什么呢,Shall沙。
05:05
再往下这个是ref。还有一个。是shaf的。好搞定,我们来看啊,这个M一点内来一个家庭。放心。诶,我一点果然变了,说明当前。的方式啊,处理对象绝对是相似的,但是我演示的比较浅是吧,咱们再来一个深一点的,看里边数据能不能变化呢?其实这一点咱们早就已经。说过了啊。就是再来复习一下吧。M1里边的car car里边的name加等于。你再刷新一下,我一点。点变了没有,变了说明没有问题,说明什么?说明上边的方式处理。
06:00
说明方式处理对象,它绝对应该是属于深度。深度劫持是吧。所以叫做什么生?监视。叫做深度响应式的数据,深度响应式啊。就是。好,那接下来我们再来看看M2啊。这个就不要了吗?好注意啊,这个是沙方式,M2点内加等于改一下。看看效果啊。浅的嘛,他说是浅的,那咱们就舔一把点一下,诶变了。那就说明沙漏这客服方式处理对象也是什么显示的对象啊好。那么我们再来处理一下看。Car应该是当前对象里边内层的这么一个对象了啊。M2点点。卡点内幕加等于等等等。走起啊。
07:01
刷新一下。没有效果,没有效果啊,那很明显了,总结吧,那说明什么问题,说明沙方式它是深度接什吗?不是,它是属于浅洁齿啊。我们也可以认为是浅皆是。那这个就是什么呢?前小于式。那还有一个M3。M3呢,是ref的方式。看M3要ref是不是应该用表白流了吧?点Y6里边的内加等于等等。是不是显示的数据。但是咱们之前说过啊,说ref如果往里边放入对象,那么这个对象呢,也会进行的处理,那么如果这个对象里边还有属性,属性当中还是对象,那这个时候每一层的对象都会通过进行处理,所以说它应该是属于深度监视啊。
08:02
这个不变了是吧,那我们再来看看啊。通过M3.y里边的看点内,看看它能不能变。我相信大家应该能够猜测的,猜测的出来啊,点一下。果然变了吧?我再来看谁看?M4呗,M4点。应该也是Y6的方式,点内加等于咔咔。电话没有没有。那大家想外层的这个啊,这个当前这个对象外层的属性它都没有变化,是不是啊,界面都没有变化,但是呢,那你就不用说了,内部的这个对象肯定有。M4点,Y6点。
09:03
你点一下果然没有效果是不是啊,那这个时候其实呢,我们可以这样做。点。看一下这个M3。大家就知道为什么。好,那我一点的时候,大家可以看一下,这有一个。这儿呢,也有一个。然后我向上滑一下,大家可以看一下这边这个Y流属性,一点开proxy,而这边这个Y流属性属于普通之下。所以说说明人家这边确实做了这个代理的一个操作了的处理是不是。那最终呢,我们看啊M3M3这个就直接复制过来吧,它也是属于深度监视的啊。那下边这个是属于什么钱呢。并且呢,咱们也可以看啊。笔记当中不也说了吗?说这玩意只处理外流的显示,不进行对象的要求处理啊。
10:02
什么时候用钱强势呢?一般情况下使用ref和。你就记就可以了啊,如果如果有一个对象数据结构比较深,但变化时只是外层变化,那这个时候就杀了,不要给我。如果有一个对象数据后面会产生新的对象来替换。那这个时候就。就暂且说到这里。
我来说两句