2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-11 18:02:29 +03:00

add support for 'null' values in json objects

This commit is contained in:
STAFYNIAK Sacha
2018-09-17 05:44:37 +02:00
parent a33910098a
commit 2808975c75
3 changed files with 25 additions and 3 deletions
+3 -2
View File
@@ -15,10 +15,11 @@ new Vue({
b: 'a',
a: 'hello word',
asd2: 1,
asd: false
asd: false,
foo: null
}
}
}
},
components: {JsonViewer}
})
})
+4 -1
View File
@@ -11,6 +11,7 @@
<script>
import JIcon from './json-icon'
import JsonString from './types/json-string';
import JsonNull from './types/json-null';
import JsonNumber from './types/json-number';
import JsonBoolean from './types/json-boolean';
import JsonObject from './types/json-object';
@@ -34,7 +35,9 @@ export default {
},
computed: {
valueType() {
if (Array.isArray(this.value)) {
if (this.value === null) {
return 'Null';
} else if (Array.isArray(this.value)) {
return 'Array';
} else if (typeof this.value === 'object') {
return 'Object';
+18
View File
@@ -0,0 +1,18 @@
<template>
<span class="json-null">null</span>
</template>
<script>
export default {
name: 'JsonNull',
props: {
jsonValue: Object
}
};
</script>
<style lang="scss">
.json-null {
color: #e08331;
}
</style>