receiver vue
时间: 2023-10-15 19:24:35 浏览: 83
在Vue中,receiver是指由Proxy创建的代理对象。在使用Proxy进行拦截操作时,可以通过传递receiver参数来改变目标对象的this指向为代理对象,从而实现对目标对象的拦截操作。具体来说,当通过代理对象读取属性时,会进入到get的捕获器里面,然后通过Reflect.get()去访问目标对象的get方法,并将this指向代理对象。这样,对目标对象属性的访问就会经过代理对象,并触发代理对象中的拦截操作。同样地,对于set操作也可以传递receiver对象。在Vue中,我们可以利用receiver参数来实现对对象属性的拦截和操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [手把手实现vue响应式原理 - Reflect 中receiver的作用(五)](https://blog.csdn.net/frontendchen/article/details/121940628)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [【Vue3源码学习】响应式源码解析:reactive、effect、ref](https://blog.csdn.net/qq_38987146/article/details/123117327)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文