vue3响应式源码分析
时间: 2023-08-26 11:18:17 浏览: 129
Vue3的响应式源码主要通过Composition API实现,而不是Options API。在Vue3中,可以使用`reactive`函数来显式地创建一个响应式对象。比如在`setup`函数中,我们可以定义一个原始数据对象`originData`,然后使用`reactive`将其转换为响应式对象`state`,最后返回`state`。这样,在组件中就可以使用`state`对象进行响应式数据的操作了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Vue3源码解析-响应式原理](https://blog.csdn.net/zhousenshan/article/details/118637718)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [【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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文