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) {
150
150
if ( data ) {
151
151
data = JSON . parse ( JSON . stringify ( data ) )
152
152
}
153
+ // include computed fields
154
+ if ( ! path ) {
155
+ for ( var key in this . $options . computed ) {
156
+ data [ key ] = this [ key ]
157
+ }
158
+ }
153
159
console . log ( data )
154
160
}
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ describe('Data API', function () {
18
18
double : function ( v ) {
19
19
return v * 2
20
20
}
21
+ } ,
22
+ computed : {
23
+ d : function ( ) {
24
+ return this . a + 1
25
+ }
21
26
}
22
27
} )
23
28
} )
@@ -161,6 +166,7 @@ describe('Data API', function () {
161
166
console . log = function ( val ) {
162
167
expect ( val . a ) . toBe ( 1 )
163
168
expect ( val . b . c ) . toBe ( 2 )
169
+ expect ( val . d ) . toBe ( 2 )
164
170
spy ( )
165
171
}
166
172
vm . $log ( )
You can’t perform that action at this time.
0 commit comments