mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-23 20:40:38 +03:00
Merge branch 'add-null-value' into 1.x
This commit is contained in:
+2
-1
@@ -16,7 +16,8 @@ new Vue({
|
|||||||
b: 'a',
|
b: 'a',
|
||||||
a: 'hello word',
|
a: 'hello word',
|
||||||
asd2: 1,
|
asd2: 1,
|
||||||
asd: false
|
asd: false,
|
||||||
|
foo: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -11,6 +11,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import JIcon from './json-icon'
|
import JIcon from './json-icon'
|
||||||
import JsonString from './types/json-string';
|
import JsonString from './types/json-string';
|
||||||
|
import JsonNull from './types/json-null';
|
||||||
import JsonNumber from './types/json-number';
|
import JsonNumber from './types/json-number';
|
||||||
import JsonBoolean from './types/json-boolean';
|
import JsonBoolean from './types/json-boolean';
|
||||||
import JsonObject from './types/json-object';
|
import JsonObject from './types/json-object';
|
||||||
@@ -35,7 +36,9 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
valueType() {
|
valueType() {
|
||||||
if (Array.isArray(this.value)) {
|
if (this.value === null || this.value === undefined) {
|
||||||
|
return 'Null';
|
||||||
|
} else if (Array.isArray(this.value)) {
|
||||||
return 'Array';
|
return 'Array';
|
||||||
} else if (typeof this.value === 'object') {
|
} else if (typeof this.value === 'object') {
|
||||||
return 'Object';
|
return 'Object';
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<span class="json-null">{{ jsonValue === null ? 'null' : 'undefined' }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'JsonNull',
|
||||||
|
props: {
|
||||||
|
jsonValue: Object
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.json-null {
|
||||||
|
color: #e08331;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user