Skip to content

Commit 859e216

Browse files
committed
chore: wip
1 parent 653f041 commit 859e216

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

src/output/ConsoleLine.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const level = ref(1)
5858
v-for="arg in log.args"
5959
:data="arg"
6060
:margin-offset="0"
61-
:increment="0"
6261
/>
6362
</template>
6463

src/output/JsonNode.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { computed, watchEffect } from 'vue'
3-
import { isObject, parse, word } from '../utils'
3+
import { parse, isObject } from '../utils'
44
const emits = defineEmits<{
55
click: []
66
}>()
@@ -17,6 +17,7 @@ const props = defineProps({
1717
open: Boolean,
1818
})
1919
20+
2021
const renderValue = computed(() => {
2122
const value = props.value
2223
if (Array.isArray(value)) return value
@@ -27,13 +28,13 @@ const renderValue = computed(() => {
2728
return value
2829
})
2930
30-
watchEffect(() => console.log(props.marginOffset))
31+
const huh = computed(() => isObject(props.value) && props.keyData !== 'root' ? props.marginOffset - 1 : props.marginOffset)
3132
</script>
3233

3334
<template>
3435
<div
3536
class="tree"
36-
:style="`margin-left: ${marginOffset}rem`"
37+
:style="`margin-left: ${huh}rem`"
3738
@click="emits('click')"
3839
>
3940
<svg
@@ -50,17 +51,13 @@ watchEffect(() => console.log(props.marginOffset))
5051
/>
5152
</svg>
5253
<span v-if="keyData !== 'root'" class="tree__title"> {{ keyData }}: </span>
53-
<span>
54-
{{ renderValue }}
55-
</span>
54+
<span>{{ renderValue }}</span>
5655
</div>
5756
</template>
5857

5958
<style>
6059
.tree {
6160
color: white;
62-
cursor: pointer;
63-
user-select: none;
6461
/* margin-bottom: 1em; */
6562
display: flex;
6663
align-items: center;

src/output/JsonTree.vue

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const props = defineProps({
1313
type: Number,
1414
default: 1,
1515
},
16-
increment: {
17-
type: Number,
18-
default: 1,
19-
},
2016
})
2117
2218
const open = ref(false)
@@ -25,7 +21,6 @@ const entries = computed(() => parse(props.data))
2521
</script>
2622

2723
<template>
28-
&nbsp;
2924
<JsonNode
3025
:keyData="keyData"
3126
:value="data"
@@ -36,10 +31,11 @@ const entries = computed(() => parse(props.data))
3631
<template v-if="entries && open">
3732
<div class="hah">
3833
<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"
4137
:data="v"
42-
:margin-offset="marginOffset + increment"
38+
:margin-offset="marginOffset + 1"
4339
/>
4440
</div>
4541
</template>

0 commit comments

Comments
 (0)