Skip to content

Commit 63b35b2

Browse files
committed
make vm.$log work for paths
1 parent 23b596f commit 63b35b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/api/data.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var _ = require('../util')
22
var Watcher = require('../watcher')
3+
var Path = require('../parse/path')
34
var textParser = require('../parse/text')
45
var dirParser = require('../parse/directive')
56
var expParser = require('../parse/expression')
@@ -146,10 +147,12 @@ exports.$interpolate = function (text) {
146147
* so that it is easier to inspect in console.
147148
* This method assumes console is available.
148149
*
149-
* @param {String} [key]
150+
* @param {String} [path]
150151
*/
151152

152-
exports.$log = function (key) {
153-
var data = this[key || '_data']
153+
exports.$log = function (path) {
154+
var data = path
155+
? Path.get(this, path)
156+
: this._data
154157
console.log(JSON.parse(JSON.stringify(data)))
155158
}

0 commit comments

Comments
 (0)