Skip to content

Commit 9912052

Browse files
authored
fix comma handling
1 parent 179c865 commit 9912052

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/components/TreeNode/index.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
@click="onBracketsClick"
3434
/>
3535

36-
<span v-else-if="customValueFormatter" :class="valueClass" v-html="customFormatter(node.content)"></span>
37-
<span v-else :class="valueClass" v-text="defaultFormatter(node.content)" />
36+
<span v-else-if="customValueFormatter" :class="valueClass" v-html="valueFormatter(node.content)"></span>
37+
<span v-else :class="valueClass" v-text="valueFormatter(node.content)" />
3838

3939
<span v-if="showLength && collapsed" class="vjs-comment"> // {{ node.length }} items </span>
4040
</span>
@@ -132,16 +132,18 @@ export default {
132132
defaultFormatter(data) {
133133
let text = data + '';
134134
if (this.dataType === 'string') text = `"${text}"`;
135-
return this.node.showComma ? `${text},` : text;
136-
},
137-
138-
customFormatter(data) {
139-
const basic = this.customValueFormatter(
140-
data,
141-
this.node.key,
142-
this.node.path,
143-
this.defaultFormatter(data),
144-
);
135+
return text;
136+
},
137+
138+
valueFormatter(data) {
139+
const basic = this.customValueFormatter
140+
? this.customValueFormatter(
141+
data,
142+
this.node.key,
143+
this.node.path,
144+
this.defaultFormatter(data),
145+
)
146+
: this.defaultFormatter(data);
145147
146148
return this.node.showComma ? `${basic},` : basic;
147149
},

0 commit comments

Comments
 (0)