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

boxed don`t show more

This commit is contained in:
陈峰
2019-03-16 21:32:37 +08:00
parent 9ba8fb4575
commit 147e0dc3e0
+11 -6
View File
@@ -13,7 +13,7 @@
</div> </div>
<div <div
class="jv-code" class="jv-code"
:class="{'open': expandCode}" :class="{'open': expandCode, boxed}"
> >
<json-box <json-box
ref="jsonBox" ref="jsonBox"
@@ -22,7 +22,7 @@
/> />
</div> </div>
<div <div
v-if="expandableCode" v-if="expandableCode && boxed"
class="jv-more" class="jv-more"
@click="toggleExpandCode" @click="toggleExpandCode"
> >
@@ -88,8 +88,10 @@ export default {
} }
}, },
mounted: function () { mounted: function () {
this.onResized() if (this.boxed && this.$refs.jsonBox) {
this.$el.addEventListener("resized", this.onResized, true) this.onResized()
this.$refs.jsonBox.$el.addEventListener("resized", this.onResized, true)
}
}, },
methods: { methods: {
onResized () { onResized () {
@@ -212,12 +214,15 @@ export default {
} }
.jv-code { .jv-code {
max-height: 300px;
overflow: hidden; overflow: hidden;
padding: 20px; padding: 20px;
&.boxed {
max-height: 300px;
}
&.open { &.open {
max-height: initial; max-height: initial !important;
overflow: visible; overflow: visible;
overflow-x: auto; overflow-x: auto;
padding-bottom: 45px; padding-bottom: 45px;