File tree Expand file tree Collapse file tree 8 files changed +28
-9
lines changed Expand file tree Collapse file tree 8 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ import VueJsonPretty from 'src';
94
94
95
95
const defaultData = {
96
96
status: 200 ,
97
- error: ' ' ,
97
+ text: ' ' ,
98
+ error: null ,
99
+ config: undefined ,
98
100
data: [
99
101
{
100
102
news_id: 51184 ,
Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ import VueJsonPretty from 'src';
56
56
57
57
const defaultData = {
58
58
status: 200 ,
59
- error: ' ' ,
59
+ text: ' ' ,
60
+ error: null ,
61
+ config: undefined ,
60
62
data: [
61
63
{
62
64
news_id: 51184 ,
Original file line number Diff line number Diff line change @@ -97,7 +97,9 @@ import VueJsonPretty from 'src';
97
97
98
98
const defaultData = {
99
99
status: 200 ,
100
- error: ' ' ,
100
+ text: ' ' ,
101
+ error: null ,
102
+ config: undefined ,
101
103
data: [
102
104
{
103
105
news_id: 51184 ,
Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ import VueJsonPretty from 'src';
48
48
49
49
const defaultData = {
50
50
status: 200 ,
51
- error: ' ' ,
51
+ text: ' ' ,
52
+ error: null ,
53
+ config: undefined ,
52
54
data: [],
53
55
};
54
56
Original file line number Diff line number Diff line change @@ -145,9 +145,14 @@ export default defineComponent({
145
145
} ;
146
146
147
147
const defaultValue = computed ( ( ) => {
148
- const str = ( props . node ?. content ?? '' ) + '' ;
149
- const text = dataType . value === 'string' ? `"${ str } "` : str ;
150
- return text ;
148
+ let value = props . node ?. content ;
149
+ if ( value === null ) {
150
+ value = 'null'
151
+ }
152
+ if ( value === undefined ) {
153
+ value = 'undefined'
154
+ }
155
+ return dataType . value === 'string' ? `"${ value } "` : value + ''
151
156
} ) ;
152
157
153
158
const renderValue = ( ) => {
Original file line number Diff line number Diff line change 55
55
.gen-value-style (@color-null );
56
56
}
57
57
58
+ .@{css-prefix} -value-undefined {
59
+ .gen-value-style (@color-undefined );
60
+ }
61
+
58
62
.@{css-prefix} -value-number {
59
63
.gen-value-style (@color-number );
60
64
}
Original file line number Diff line number Diff line change 6
6
@color-info : #1d8ce0 ;
7
7
@color-error : #ff4949 ;
8
8
@color-success : #13ce66 ;
9
+ @color-nil : #D55FDE ;
9
10
10
11
/* field values color */
11
12
@color-string : @color-success ;
12
13
@color-number : @color-info ;
13
14
@color-boolean : @color-info ;
14
- @color-null : @color-error ;
15
+ @color-null : @color-nil ;
16
+ @color-undefined : @color-nil ;
15
17
16
18
/* highlight */
17
19
@highlight-bg-color : #e6f7ff ;
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export function arrFlat<T extends unknown[]>(arr: T): unknown[] {
133
133
}
134
134
135
135
export function cloneDeep < T extends unknown > ( source : T , hash = new WeakMap ( ) ) : T {
136
- if ( source === null ) return source ;
136
+ if ( source === null || source === undefined ) return source ;
137
137
if ( source instanceof Date ) return new Date ( source ) as T ;
138
138
if ( source instanceof RegExp ) return new RegExp ( source ) as T ;
139
139
if ( typeof source !== 'object' ) return source ;
You can’t perform that action at this time.
0 commit comments