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)
5858 v-for =" arg in log.args"
5959 :data =" arg"
6060 :margin-offset =" 0"
61- :increment =" 0"
6261 />
6362 </template >
6463
Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import { computed , watchEffect } from ' vue'
3- import { isObject , parse , word } from ' ../utils'
3+ import { parse , isObject } from ' ../utils'
44const emits = defineEmits <{
55 click: []
66}>()
@@ -17,6 +17,7 @@ const props = defineProps({
1717 open: Boolean ,
1818})
1919
20+
2021const 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 ;
Original file line number Diff line number Diff 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
2218const open = ref (false )
@@ -25,7 +21,6 @@ const entries = computed(() => parse(props.data))
2521 </script >
2622
2723<template >
28-   ;
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 >
You can’t perform that action at this time.
0 commit comments