2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-08 17:22:32 +03:00

Merge branch 'add-null-value' into 1.x

This commit is contained in:
STAFYNIAK Sacha
2018-09-17 06:02:07 +02:00
3 changed files with 24 additions and 2 deletions
+2 -1
View File
@@ -16,7 +16,8 @@ new Vue({
b: 'a',
a: 'hello word',
asd2: 1,
asd: false
asd: false,
foo: null
}
}
}
+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';
@@ -35,7 +36,9 @@ export default {
},
computed: {
valueType() {
if (Array.isArray(this.value)) {
if (this.value === null || this.value === undefined) {
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">{{ jsonValue === null ? 'null' : 'undefined' }}</span>
</template>
<script>
export default {
name: 'JsonNull',
props: {
jsonValue: Object
}
};
</script>
<style lang="scss">
.json-null {
color: #e08331;
}
</style>