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:
+2
-1
@@ -16,7 +16,8 @@ new Vue({
|
||||
b: 'a',
|
||||
a: 'hello word',
|
||||
asd2: 1,
|
||||
asd: false
|
||||
asd: false,
|
||||
foo: null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -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';
|
||||
|
||||
@@ -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