2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-20 20:00:37 +03:00

fix: xss bug

This commit is contained in:
陈峰
2019-08-31 17:32:20 +08:00
parent c0a26557e0
commit c4945eddba
7 changed files with 29 additions and 14 deletions
+9 -3
View File
@@ -66,8 +66,9 @@ export default {
} else if (typeof this.value === 'function') {
dataType = JsonFunction
}
const toggle = this.keyName && (this.value && (Array.isArray(this.value) || typeof this.value === 'object'))
if (this.keyName && (this.value && (Array.isArray(this.value) || typeof this.value === 'object'))) {
if (toggle) {
elements.push(h('span', {
class: {
'jv-toggle': true,
@@ -85,7 +86,7 @@ export default {
'jv-key': true
},
domProps: {
innerHTML: `${this.keyName}:`
innerText: `${this.keyName}:`
}
}))
}
@@ -110,7 +111,8 @@ export default {
return h('div', {
class: {
'jv-node': true
'jv-node': true,
'toggle': toggle
}
}, elements)
}
@@ -130,6 +132,10 @@ export default {
}
}
&.toggle {
margin-left: 13px !important;
}
& .jv-node {
margin-left: 25px;
}