File tree Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,6 @@ const level = ref(1)
58
58
v-for =" arg in log.args"
59
59
:data =" arg"
60
60
:margin-offset =" 0"
61
- :increment =" 0"
62
61
/>
63
62
</template >
64
63
Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
2
import { computed , watchEffect } from ' vue'
3
- import { isObject , parse , word } from ' ../utils'
3
+ import { parse , isObject } from ' ../utils'
4
4
const emits = defineEmits <{
5
5
click: []
6
6
}>()
@@ -17,6 +17,7 @@ const props = defineProps({
17
17
open: Boolean ,
18
18
})
19
19
20
+
20
21
const renderValue = computed (() => {
21
22
const value = props .value
22
23
if (Array .isArray (value )) return value
@@ -27,13 +28,13 @@ const renderValue = computed(() => {
27
28
return value
28
29
})
29
30
30
- watchEffect (() => console . log (props .marginOffset ) )
31
+ const huh = computed (() => isObject (props .value ) && props . keyData !== ' root ' ? props . marginOffset - 1 : props . marginOffset )
31
32
</script >
32
33
33
34
<template >
34
35
<div
35
36
class =" tree"
36
- :style =" `margin-left: ${marginOffset }rem`"
37
+ :style =" `margin-left: ${huh }rem`"
37
38
@click =" emits('click')"
38
39
>
39
40
<svg
@@ -50,17 +51,13 @@ watchEffect(() => console.log(props.marginOffset))
50
51
/>
51
52
</svg >
52
53
<span v-if =" keyData !== 'root'" class =" tree__title" > {{ keyData }}: </span >
53
- <span >
54
- {{ renderValue }}
55
- </span >
54
+ <span >{{ renderValue }}</span >
56
55
</div >
57
56
</template >
58
57
59
58
<style >
60
59
.tree {
61
60
color : white ;
62
- cursor : pointer ;
63
- user-select : none ;
64
61
/* margin-bottom: 1em; */
65
62
display : flex ;
66
63
align-items : center ;
Original file line number Diff line number Diff line change @@ -13,10 +13,6 @@ const props = defineProps({
13
13
type: Number ,
14
14
default: 1 ,
15
15
},
16
- increment: {
17
- type: Number ,
18
- default: 1 ,
19
- },
20
16
})
21
17
22
18
const open = ref (false )
@@ -25,7 +21,6 @@ const entries = computed(() => parse(props.data))
25
21
</script >
26
22
27
23
<template >
28
-   ;
29
24
<JsonNode
30
25
:keyData =" keyData"
31
26
:value =" data"
@@ -36,10 +31,11 @@ const entries = computed(() => parse(props.data))
36
31
<template v-if =" entries && open " >
37
32
<div class =" hah" >
38
33
<JsonTree
39
- v-for =" [k, v] in entries"
40
- :key =" k"
34
+ v-for =" ([k, v], idx) in entries"
35
+ :key =" idx"
36
+ :key-data =" k"
41
37
:data =" v"
42
- :margin-offset =" marginOffset + increment "
38
+ :margin-offset =" marginOffset + 1 "
43
39
/>
44
40
</div >
45
41
</template >
You can’t perform that action at this time.
0 commit comments