From 948b1df03ec4018b24a8fe5d06716f55a6a8342f Mon Sep 17 00:00:00 2001 From: James Furey Date: Sat, 31 Oct 2015 12:42:39 +1100 Subject: [PATCH 1/2] Added an API note regarding extracting the source plain data object via JSON parse/stringify. --- src/api/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/index.md b/src/api/index.md index d5cf968afd..6d2aabba70 100644 --- a/src/api/index.md +++ b/src/api/index.md @@ -353,10 +353,12 @@ type: api The data object for the Vue instance. Vue.js will recursively convert its properties into getter/setters to make it "reactive". **The object must be plain**: native objects, existing getter/setters and prototype properties are ignored. It is not recommended to observe complex objects. - Once the instance is created, the original data object can be accessed as `vm.$data`. The Vue instance also proxies all the properties found on the data object. + Once the instance is created, the data object can be accessed as `vm.$data`. The Vue instance also proxies all the properties found on the data object. Properties that start with `_` or `$` will **not** be proxied on the Vue instance because they may conflict with Vue's internal properties and API methods. You will have to access them as `vm.$data._property`. + If required, the original **plain** data object can be extracted by passing `vm.$data` through `JSON.parse(JSON.stringify(...))`. + - **Example:** ``` js From 57d645cd6c65f29b8711aebae35fc4fabd6c40a0 Mon Sep 17 00:00:00 2001 From: James Furey Date: Mon, 2 Nov 2015 10:10:47 +1100 Subject: [PATCH 2/2] Clarified terminology. --- src/api/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/index.md b/src/api/index.md index 6d2aabba70..ccb9598630 100644 --- a/src/api/index.md +++ b/src/api/index.md @@ -353,11 +353,11 @@ type: api The data object for the Vue instance. Vue.js will recursively convert its properties into getter/setters to make it "reactive". **The object must be plain**: native objects, existing getter/setters and prototype properties are ignored. It is not recommended to observe complex objects. - Once the instance is created, the data object can be accessed as `vm.$data`. The Vue instance also proxies all the properties found on the data object. + Once the instance is created, the original data object can be accessed as `vm.$data`. The Vue instance also proxies all the properties found on the data object. Properties that start with `_` or `$` will **not** be proxied on the Vue instance because they may conflict with Vue's internal properties and API methods. You will have to access them as `vm.$data._property`. - If required, the original **plain** data object can be extracted by passing `vm.$data` through `JSON.parse(JSON.stringify(...))`. + If required, a deep clone of the original object can be obtained by passing `vm.$data` through `JSON.parse(JSON.stringify(...))`. - **Example:**