Skip to content

Commit ebf57a8

Browse files
committed
fix: White space before commas. #115
1 parent 1eef518 commit ebf57a8

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

src/components/TreeNode/index.vue

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,15 @@
2525
/>
2626
<span v-if="node.key" class="vjs-key">{{ prettyKey }}:</span>
2727

28-
<span class="vjs-value__container">
28+
<span>
2929
<brackets
3030
v-if="node.type !== 'content'"
3131
:data="node.content"
3232
:collapsed-on-click-brackets="collapsedOnClickBrackets"
3333
@click="onBracketsClick"
3434
/>
3535

36-
<template v-else>
37-
<span
38-
v-if="customValueFormatter"
39-
:class="valueClass"
40-
v-html="customFormatter(node.content)"
41-
/>
42-
<span v-else :class="valueClass">{{ defaultFormatter(node.content) }}</span>
43-
</template>
44-
45-
<span v-if="node.showComma">,</span>
36+
<span v-else :class="valueClass" v-html="valueFormatter(node.content)" />
4637

4738
<span v-if="showLength && collapsed" class="vjs-comment"> // {{ node.length }} items </span>
4839
</span>
@@ -143,15 +134,17 @@ export default {
143134
return text;
144135
},
145136
146-
customFormatter(data) {
147-
return this.customValueFormatter
137+
valueFormatter(data) {
138+
const basic = this.customValueFormatter
148139
? this.customValueFormatter(
149140
data,
150141
this.node.key,
151142
this.node.path,
152143
this.defaultFormatter(data),
153144
)
154145
: this.defaultFormatter(data);
146+
147+
return this.node.showComma ? `${basic},` : basic;
155148
},
156149
157150
onBracketsClick() {

src/components/TreeNode/styles.less

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@
3030
color: @comment-color;
3131
}
3232

33-
.@{css-prefix}-value__container {
34-
white-space: nowrap;
35-
&:after {
36-
content: '';
37-
clear: both;
38-
}
39-
}
40-
41-
.@{css-prefix}-value {
42-
float: left;
43-
}
44-
4533
.@{css-prefix}-value__null {
4634
.gen-value-style(@color-null);
4735
}

0 commit comments

Comments
 (0)