Browse Source

fix vm.$log when property is not observed or does not exist

Evan You 11 years ago
parent
commit
88996727f5
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/api/data.js

+ 5 - 2
src/api/data.js

@@ -152,7 +152,10 @@ exports.$interpolate = function (text) {
 
 exports.$log = function (path) {
   var data = path
-    ? Path.get(this, path)
+    ? Path.get(this._data, path)
     : this._data
-  console.log(JSON.parse(JSON.stringify(data)))
+  if (data) {
+    data = JSON.parse(JSON.stringify(data))
+  }
+  console.log(data)
 }