File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -150,5 +150,11 @@ exports.$log = function (path) {
150150 if ( data ) {
151151 data = JSON . parse ( JSON . stringify ( data ) )
152152 }
153+ // include computed fields
154+ if ( ! path ) {
155+ for ( var key in this . $options . computed ) {
156+ data [ key ] = this [ key ]
157+ }
158+ }
153159 console . log ( data )
154160}
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ describe('Data API', function () {
1818 double : function ( v ) {
1919 return v * 2
2020 }
21+ } ,
22+ computed : {
23+ d : function ( ) {
24+ return this . a + 1
25+ }
2126 }
2227 } )
2328 } )
@@ -161,6 +166,7 @@ describe('Data API', function () {
161166 console . log = function ( val ) {
162167 expect ( val . a ) . toBe ( 1 )
163168 expect ( val . b . c ) . toBe ( 2 )
169+ expect ( val . d ) . toBe ( 2 )
164170 spy ( )
165171 }
166172 vm . $log ( )
You can’t perform that action at this time.
0 commit comments