Skip to content

Commit b152c9f

Browse files
author
YuChengKai
authored
Merge pull request #104 from timeTravelCYN/master
fix typo
2 parents 1430469 + 16656b0 commit b152c9f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Framework/framework-en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- [MVVM](#mvvm)
66
- [Dirty Checking](#dirty-checking)
77
- [Data hijacking](#data-hijacking)
8-
- [Proxy vs. Obeject.defineProperty](#proxy-vs-obejectdefineproperty)
8+
- [Proxy vs. Object.defineProperty](#proxy-vs-objectdefineproperty)
99
- [Routing principle](#routing-principle)
1010
- [Virtual Dom](#virtual-dom)
1111
- [Why Virtual Dom is needed](#why-virtual-dom-is-needed)
@@ -45,7 +45,7 @@ Although dirty checking has inefficiencies, it can complete the task without car
4545

4646
## Data hijacking
4747

48-
Vue internally uses `Obeject.defineProperty()` to implement two-way binding, which allows you to listen for events of `set` and `get`.
48+
Vue internally uses `Object.defineProperty()` to implement two-way binding, which allows you to listen for events of `set` and `get`.
4949

5050
```js
5151
var data = { name: 'yck' }
@@ -175,9 +175,9 @@ The above implements a simple two-way binding. The core idea is to manually trig
175175

176176

177177

178-
## Proxy vs. Obeject.defineProperty
178+
## Proxy vs. Object.defineProperty
179179

180-
Although `Obeject.defineProperty` has been able to implement two-way binding, it is still flawed.
180+
Although `Object.defineProperty` has been able to implement two-way binding, it is still flawed.
181181

182182
* It can only implement data hijacking on properties, so it needs deep traversal of the entire object
183183
* it can't listen to changes in data for arrays
@@ -222,7 +222,7 @@ methodsToPatch.forEach(function (method) {
222222
})
223223
```
224224

225-
On the other hand, `Proxy` doesn't have the above problem. It natively supports listening to array changes and can intercept the entire object directly, so Vue will also replace `Obeject.defineProperty` with `Proxy` in the next big version.
225+
On the other hand, `Proxy` doesn't have the above problem. It natively supports listening to array changes and can intercept the entire object directly, so Vue will also replace `Object.defineProperty` with `Proxy` in the next big version.
226226

227227
```js
228228
let onWatch = (obj, setBind, getLogger) => {

Framework/framework-zh.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- [MVVM](#mvvm)
66
- [脏数据检测](#%E8%84%8F%E6%95%B0%E6%8D%AE%E6%A3%80%E6%B5%8B)
77
- [数据劫持](#%E6%95%B0%E6%8D%AE%E5%8A%AB%E6%8C%81)
8-
- [Proxy 与 Obeject.defineProperty 对比](#proxy-%E4%B8%8E-obejectdefineproperty-%E5%AF%B9%E6%AF%94)
8+
- [Proxy 与 Object.defineProperty 对比](#proxy-%E4%B8%8E-objectdefineproperty-%E5%AF%B9%E6%AF%94)
99
- [路由原理](#%E8%B7%AF%E7%94%B1%E5%8E%9F%E7%90%86)
1010
- [Virtual Dom](#virtual-dom)
1111
- [为什么需要 Virtual Dom](#%E4%B8%BA%E4%BB%80%E4%B9%88%E9%9C%80%E8%A6%81-virtual-dom)
@@ -42,7 +42,7 @@ MVVM 由以下三个内容组成
4242

4343
## 数据劫持
4444

45-
Vue 内部使用了 `Obeject.defineProperty()` 来实现双向绑定,通过这个函数可以监听到 `set``get` 的事件。
45+
Vue 内部使用了 `Object.defineProperty()` 来实现双向绑定,通过这个函数可以监听到 `set``get` 的事件。
4646

4747
```js
4848
var data = { name: 'yck' }
@@ -169,9 +169,9 @@ function defineReactive(obj, key, val) {
169169

170170
以上实现了一个简易的双向绑定,核心思路就是手动触发一次属性的 getter 来实现发布订阅的添加。
171171

172-
## Proxy 与 Obeject.defineProperty 对比
172+
## Proxy 与 Object.defineProperty 对比
173173

174-
`Obeject.defineProperty` 虽然已经能够实现双向绑定了,但是他还是有缺陷的。
174+
`Object.defineProperty` 虽然已经能够实现双向绑定了,但是他还是有缺陷的。
175175

176176
1. 只能对属性进行数据劫持,所以需要深度遍历整个对象
177177
2. 对于数组不能监听到数据的变化
@@ -216,7 +216,7 @@ methodsToPatch.forEach(function (method) {
216216
})
217217
```
218218

219-
反观 Proxy 就没以上的问题,原生支持监听数组变化,并且可以直接对整个对象进行拦截,所以 Vue 也将在下个大版本中使用 Proxy 替换 Obeject.defineProperty
219+
反观 Proxy 就没以上的问题,原生支持监听数组变化,并且可以直接对整个对象进行拦截,所以 Vue 也将在下个大版本中使用 Proxy 替换 Object.defineProperty
220220

221221
```js
222222
let onWatch = (obj, setBind, getLogger) => {

0 commit comments

Comments
 (0)