Skip to content

Commit cc96de7

Browse files
committed
feat: 新增 key slot
1 parent ed8a4ad commit cc96de7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/json-tree/JsonTreeNode.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
<div class="json-tree__content__header">
2222
<!-- jsonKey: -->
2323
<span v-if="showJsonKey">
24-
<span v-text="jsonKey" :class="[
24+
<span :class="[
2525
'json-tree__key',
2626
`json-tree__key--${typeof jsonKey}`
27-
]"></span>
27+
]">
28+
<slot name="key" v-bind:item-key="jsonKey">{{ jsonKey }}</slot>
29+
</span>
2830
<span class="json-tree__colon">:</span>
2931
</span>
3032

@@ -70,7 +72,7 @@
7072
`json-tree__val--${jsonDataType}`
7173
]">
7274
<slot name="val"
73-
v-bind:val="jsonData"
75+
v-bind:item-val="jsonData"
7476
v-bind:type="jsonDataType">{{ displayedJsonVal }}</slot>
7577
</span>
7678
</template>
@@ -109,7 +111,7 @@
109111
`json-tree__val--${jsonDataType}`
110112
]">
111113
<slot name="val"
112-
v-bind:val="jsonData"
114+
v-bind:item-val="jsonData"
113115
v-bind:type="jsonDataType">{{ displayedJsonVal }}</slot>
114116
</span>
115117
</template>

0 commit comments

Comments
 (0)