Skip to content

Commit 247949b

Browse files
committed
fix: Spaces are not added between keys and values.
1 parent ff44366 commit 247949b

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

example/Basic.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<label>showDoubleQuotes</label>
2727
<input v-model="showDoubleQuotes" type="checkbox" />
2828
</div>
29+
<div>
30+
<label>showKeyValueSpace</label>
31+
<input v-model="showKeyValueSpace" type="checkbox" />
32+
</div>
2933
<div>
3034
<label>highlightMouseoverNode</label>
3135
<input v-model="highlightMouseoverNode" type="checkbox" />
@@ -68,6 +72,7 @@
6872
:highlight-mouseover-node="highlightMouseoverNode"
6973
:collapsed-on-click-brackets="collapsedOnClickBrackets"
7074
:show-icon="showIcon"
75+
:show-key-value-space="showKeyValueSpace"
7176
style="position: relative"
7277
>
7378
<template v-if="useNodeKeySlot" #nodeKey="{ node, defaultKey }">
@@ -138,6 +143,7 @@ export default {
138143
useNodeKeySlot: false,
139144
deep: 3,
140145
showIcon: false,
146+
showKeyValueSpace: true,
141147
};
142148
},
143149
watch: {

src/components/Tree/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
:node-selectable="nodeSelectable"
3939
:highlight-selected-node="highlightSelectedNode"
4040
:show-icon="showIcon"
41+
:show-key-value-space="showKeyValueSpace"
4142
:editable="editable"
4243
:editable-trigger="editableTrigger"
4344
@node-click="handleNodeClick"
@@ -164,6 +165,10 @@ export default {
164165
type: Boolean,
165166
default: false,
166167
},
168+
showKeyValueSpace: {
169+
type: Boolean,
170+
default: true,
171+
},
167172
editable: {
168173
type: Boolean,
169174
default: false,

src/components/TreeNode/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
<span v-if="node.key" class="vjs-key">
3737
<slot name="key" :node="node" :defaultKey="prettyKey">{{ prettyKey }}</slot>
38-
<span>:</span>
38+
<span class="vjs-colon">{{ `:${showKeyValueSpace ? ' ' : ''}` }}</span>
3939
</span>
4040

4141
<span>
@@ -135,6 +135,10 @@ export default {
135135
type: Boolean,
136136
default: false,
137137
},
138+
showKeyValueSpace: {
139+
type: Boolean,
140+
default: true,
141+
},
138142
editable: {
139143
type: Boolean,
140144
default: false,

src/components/TreeNode/styles.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
margin-right: 4px;
4444
}
4545

46+
.@{css-prefix}-colon {
47+
white-space: pre;
48+
}
49+
4650
.@{css-prefix}-comment {
4751
color: @comment-color;
4852
}

0 commit comments

Comments
 (0)