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

last of type bugs

This commit is contained in:
陈峰
2017-10-18 14:39:10 +08:00
parent dc0470b647
commit 32e26721d8
12 changed files with 3743 additions and 18 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import Vue from 'vue'; import Vue from 'vue';
import JsonViewer from '../'; import JsonViewer from '../';
import './css/ionicons.css';
new Vue({ new Vue({
el: '#app', el: '#app',
@@ -17,7 +18,7 @@ new Vue({
} }
}, },
showCopy: true, showCopy: true,
iconPrefix: 'ive-' iconPrefix: 'ion'
} }
}) })
}) })
+1480
View File
File diff suppressed because one or more lines are too long
+11
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
+2230
View File
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 326 KiB

BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+3 -4
View File
@@ -1,7 +1,7 @@
<template> <template>
<div class="node"> <div class="node">
<span class="key" v-if="keyName"> <span class="key" v-if="keyName">
<j-icon v-if="isObject" :type="value ? 'ion-arrow-down-b' : 'ion-arrow-up-b'" @click.stop="toggleNode"></j-icon> <j-icon v-if="isObject" :type="value ? 'arrow-down-b' : 'arrow-up-b'" @click.stop="toggleNode"></j-icon>
{{keyName}}: {{keyName}}:
</span> </span>
<commponent :is="`Json${valueType}`" :json-value="value" v-model="toggle" :key-name="keyName"></commponent> <commponent :is="`Json${valueType}`" :json-value="value" v-model="toggle" :key-name="keyName"></commponent>
@@ -71,15 +71,14 @@ export default {
&:after { &:after {
content: ',' content: ','
} }
&:last-child { &:last-of-type {
&:after { &:after {
content: '' content: ''
} }
} }
.icon { .j-icon {
position: absolute; position: absolute;
left: -12px; left: -12px;
font-size: 12px;
top: 3px; top: 3px;
color: #80848f; color: #80848f;
cursor: pointer; cursor: pointer;
+3 -3
View File
@@ -1,7 +1,7 @@
<template> <template>
<i :class="{ <i class="j-icon" :class="{
[`${iconPrefix}icon`]: true, [`${iconPrefix}`]: true,
[`${iconPrefix}${type}`]: true [`${iconPrefix}-${type}`]: true
}" @click="iconClick"></i> }" @click="iconClick"></i>
</template> </template>
+12 -8
View File
@@ -1,15 +1,15 @@
<template> <template>
<div class="json-viewer"> <div class="json-viewer">
<div class="tooltip"> <div class="tooltip">
<j-icon v-if="showBigger" type="ion-qr-scanner" @click="bigger"></j-icon> <j-icon v-if="showBigger" type="qr-scanner" @click="bigger"></j-icon>
<j-icon v-if="copied" class="copied" type="ion-checkmark"></j-icon> <j-icon v-if="copied" class="copied" type="checkmark"></j-icon>
<j-icon v-if="showCopy && !copied" class="copy" type="ion-md-clipboard" @click="clip"></j-icon> <j-icon v-if="showCopy && !copied" class="copy" type="clipboard" @click="clip"></j-icon>
</div> </div>
<div class="code-box" :class="{'more': moreCode}"> <div class="code-box" :class="{'more': moreCode}">
<json-box :value="value" :key-name="keyName"></json-box> <json-box :value="value" :key-name="keyName"></json-box>
</div> </div>
<div class="more-code" @click="toggleMoreCode"> <div class="more-code" @click="toggleMoreCode">
<j-icon :type="moreCode ? 'ion-ios-arrow-up' : 'ion-ios-arrow-down'"></j-icon> <j-icon :type="moreCode ? 'ios-arrow-up' : 'ios-arrow-down'"></j-icon>
</div> </div>
</div> </div>
</template> </template>
@@ -42,7 +42,7 @@ export default {
}, },
provide() { provide() {
return { return {
iconPrefix: this.iconPrefix iconPrefix: this.iconPrefix || 'ion'
} }
}, },
data() { data() {
@@ -113,7 +113,7 @@ export default {
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
.icon { .j-icon {
position: relative; position: relative;
z-index: 2; z-index: 2;
} }
@@ -134,7 +134,6 @@ export default {
position: absolute; position: absolute;
right: 12px; right: 12px;
top: 5px; top: 5px;
font-size: 18px;
color: #b2b2b2; color: #b2b2b2;
cursor: pointer; cursor: pointer;
@@ -142,9 +141,14 @@ export default {
color: #19be6b; color: #19be6b;
} }
.icon { .j-icon {
margin-left: 5px; margin-left: 5px;
font-size: 18px;
} }
} }
.j-icon {
font-size: 12px;
}
} }
</style> </style>
+1 -1
View File
@@ -1,6 +1,6 @@
<template> <template>
<span> <span>
<j-icon v-if="!keyName" :type="value ? 'ion-arrow-down-b' : 'ion-arrow-up-b'" @click.stop="toggle"></j-icon> <j-icon v-if="!keyName" :type="value ? 'arrow-down-b' : 'arrow-up-b'" @click.stop="toggle"></j-icon>
<span>[</span> <span>[</span>
<template v-if="jsonValue.length"> <template v-if="jsonValue.length">
<json-box v-show="value" v-for="(val, index) in jsonValue" :key="index" :value="val"></json-box> <json-box v-show="value" v-for="(val, index) in jsonValue" :key="index" :value="val"></json-box>
+1 -1
View File
@@ -1,6 +1,6 @@
<template> <template>
<span> <span>
<j-icon v-if="!keyName" :type="value ? 'ion-arrow-down-b' : 'ion-arrow-up-b'" @click.stop="toggle"></j-icon> <j-icon v-if="!keyName" :type="value ? 'arrow-down-b' : 'arrow-up-b'" @click.stop="toggle"></j-icon>
<span>{</span> <span>{</span>
<template v-if="Object.keys(jsonValue).length"> <template v-if="Object.keys(jsonValue).length">
<json-box v-show="value" v-for="(v, k) in jsonValue" :key="k" :key-name="k" :value="v"></json-box> <json-box v-show="value" v-for="(v, k) in jsonValue" :key="k" :key-name="k" :value="v"></json-box>