1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

#115 fix new lines - use pre

This commit is contained in:
lana-k
2024-01-06 18:55:45 +01:00
parent 7a18e415c8
commit d949629ee4
4 changed files with 38 additions and 25 deletions

View File

@@ -26,12 +26,10 @@
:value="formattedJson"
:options="cmOptions"
/>
<div
<pre
v-if="currentFormat === 'text'"
:class="['text-value', { 'meta-value': isNull || isBlob }]"
>
{{ cellValue }}
</div>
>{{ cellText }}</pre>
<logs
v-if="messages && messages.length > 0"
:messages="messages"
@@ -59,9 +57,7 @@ export default {
Logs
},
props: {
cellValue: [String, Number],
isNull: Boolean,
isBlob: Boolean
cellValue: [String, Number, Uint8Array]
},
data () {
return {
@@ -84,17 +80,35 @@ export default {
messages: []
}
},
computed: {
isBlob () {
return this.cellValue && ArrayBuffer.isView(this.cellValue)
},
isNull () {
return this.cellValue === null
},
cellText () {
const value = this.cellValue
if (this.isNull) {
return 'NULL'
}
if (this.isBlob) {
return 'BLOB'
}
return value
}
},
watch: {
currentFormat () {
this.messages = []
this.formattedJson = ''
if (this.currentFormat === 'json') {
this.formatJson(this.isNull ? null : this.cellValue)
this.formatJson(this.cellValue)
}
},
cellValue () {
if (this.currentFormat === 'json') {
this.formatJson(this.isNull ? null : this.cellValue)
this.formatJson(this.cellValue)
}
}
},