mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-23 20:40:38 +03:00
Migrate box and viewer
This commit is contained in:
+12
-19
@@ -1,4 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { h } from 'vue'
|
||||||
import JsonString from './types/json-string'
|
import JsonString from './types/json-string'
|
||||||
import JsonUndefined from './types/json-undefined'
|
import JsonUndefined from './types/json-undefined'
|
||||||
import JsonNumber from './types/json-number'
|
import JsonNumber from './types/json-number'
|
||||||
@@ -49,7 +50,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render (h) {
|
render () {
|
||||||
let elements = []
|
let elements = []
|
||||||
let dataType
|
let dataType
|
||||||
|
|
||||||
@@ -78,9 +79,7 @@ export default {
|
|||||||
'jv-toggle': true,
|
'jv-toggle': true,
|
||||||
open: !!this.expand
|
open: !!this.expand
|
||||||
},
|
},
|
||||||
on: {
|
onClick: this.toggle
|
||||||
click: this.toggle
|
|
||||||
}
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,9 +88,7 @@ export default {
|
|||||||
class: {
|
class: {
|
||||||
'jv-key': true
|
'jv-key': true
|
||||||
},
|
},
|
||||||
domProps: {
|
innerText: `${this.keyName}:`
|
||||||
innerText: `${this.keyName}:`
|
|
||||||
}
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,18 +96,14 @@ export default {
|
|||||||
class: {
|
class: {
|
||||||
'jv-push': true
|
'jv-push': true
|
||||||
},
|
},
|
||||||
props: {
|
jsonValue: this.value,
|
||||||
jsonValue: this.value,
|
keyName: this.keyName,
|
||||||
keyName: this.keyName,
|
sort: this.sort,
|
||||||
sort: this.sort,
|
depth: this.depth,
|
||||||
depth: this.depth,
|
expand: this.expand,
|
||||||
expand: this.expand,
|
previewMode: this.previewMode,
|
||||||
previewMode: this.previewMode,
|
'onUpdate:expand': value => {
|
||||||
},
|
this.expand = value
|
||||||
on: {
|
|
||||||
'update:expand': value => {
|
|
||||||
this.expand = value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="viewer" :class="jvClass">
|
<div ref="viewer" :class="jvClass">
|
||||||
<div
|
<div
|
||||||
v-if="copyable"
|
v-if="copyable"
|
||||||
:class="`jv-tooltip ${copyText.align || 'right'}`"
|
:class="`jv-tooltip ${copyText.align || 'right'}`"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
ref="clip"
|
ref="clip"
|
||||||
class="jv-button"
|
class="jv-button"
|
||||||
:class="{copied}"
|
:class="{copied}"
|
||||||
>
|
>
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="jv-code"
|
class="jv-code"
|
||||||
:class="{'open': expandCode, boxed}"
|
:class="{'open': expandCode, boxed}"
|
||||||
>
|
>
|
||||||
<json-box
|
<json-box
|
||||||
@@ -28,13 +28,13 @@
|
|||||||
:preview-mode="previewMode"
|
:preview-mode="previewMode"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="expandableCode && boxed"
|
v-if="expandableCode && boxed"
|
||||||
class="jv-more"
|
class="jv-more"
|
||||||
@click="toggleExpandCode"
|
@click="toggleExpandCode"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="jv-toggle"
|
class="jv-toggle"
|
||||||
:class="{open: !!expandCode}"
|
:class="{open: !!expandCode}"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -334,7 +334,7 @@ export default {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.jv-toggle {
|
.jv-toggle {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
color: #111;
|
color: #111;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user