mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-23 20:40:38 +03:00
add support for 'function' values in json objects
This commit is contained in:
@@ -31,6 +31,7 @@ export default {
|
||||
{key: 'hello word'},
|
||||
],
|
||||
val: {
|
||||
c: () = {},
|
||||
b: 'a',
|
||||
a: 'hello word',
|
||||
asd2: 1,
|
||||
|
||||
@@ -12,6 +12,7 @@ new Vue({
|
||||
{key: 'hello word'},
|
||||
],
|
||||
val: {
|
||||
c: () = {},
|
||||
b: 'a',
|
||||
a: 'hello word',
|
||||
asd2: 1,
|
||||
|
||||
@@ -15,6 +15,7 @@ import JsonNumber from './types/json-number';
|
||||
import JsonBoolean from './types/json-boolean';
|
||||
import JsonObject from './types/json-object';
|
||||
import JsonArray from './types/json-array';
|
||||
import JsonFunction from './types/json-function';
|
||||
|
||||
export default {
|
||||
name: 'JsonBox',
|
||||
@@ -44,6 +45,8 @@ export default {
|
||||
return 'String';
|
||||
} else if (typeof this.value === 'boolean') {
|
||||
return 'Boolean';
|
||||
} else if (typeof this.value === 'function') {
|
||||
return 'Function';
|
||||
}
|
||||
},
|
||||
isObject() {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<span class="json-function"><function></span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'JsonFunction',
|
||||
props: {
|
||||
jsonValue: Function
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.json-function {
|
||||
color: #067bca;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user