---
title: "Discussion on \"vue双向数据绑定与抽象语法树\" | Hashnode"
description: "Discussion on \"vue双向数据绑定与抽象语法树\". 双向数据绑定原理\n// 数据劫持/数据代理\nobject.defineProperty()\n数组通过改写数组中push,pop,shift,unshift,splice,sort,reverse等方法实现数组的双向绑定。\nvue的双向数据绑定，是采用数据劫持结合发布者和订阅者模式的方式，通过Object.defineProperty()来劫持各个属性的setter，getter，在数据变动时发布消息给订阅者，触发相应的监听回调，getter函数里面执行的任务是watcher订阅者, 而sette..."
url: "https://hashnode.com/posts/vue-knowledge/62aff152d8afe74aa51fe821"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [vue双向数据绑定与抽象语法树](https://zmblog.hashnode.dev/vue-knowledge?utm_source=hashnode&utm_medium=feed)

双向数据绑定原理 // 数据劫持/数据代理 object.defineProperty() 数组通过改写数组中push,pop,shift,unshift,splice,sort,reverse等方法实现数组的双向绑定。 vue的双向数据绑定，是采用数据劫持结合发布者和订阅者模式的方式，通过Object.defineProperty()来劫持各个属性的setter，getter，在数据变动时发布消息给订阅者，触发相应的监听回调，getter函数里面执行的任务是watcher订阅者, 而sette...

Jun 20, 2022 · 1 min read · zmblog.hashnode.dev  
Updated Jul 4, 2022  
Read the article

-   [#vue](https://hashnode.com/tag/vue)

## Written by

[明](https://hashnode.com/@zm144)

@zm144

  
[View profile](https://hashnode.com/@zm144)

learn

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
