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

Support for incremental update components

This commit is contained in:
陈峰
2019-06-12 19:37:52 +08:00
parent 6e7c4eb113
commit 6b09e02ac8
4 changed files with 74 additions and 9 deletions
+5
View File
@@ -37,6 +37,7 @@
import Vue from 'vue'
import JsonBox from './json-box'
import Clipboard from 'clipboard'
import {debounce} from './utils';
export default {
name: 'JsonViewer',
@@ -92,6 +93,7 @@ export default {
}
},
mounted: function () {
this.debounceResized = debounce(this.debResized.bind(this), 200);
if (this.boxed && this.$refs.jsonBox) {
this.onResized()
this.$refs.jsonBox.$el.addEventListener("resized", this.onResized, true)
@@ -109,6 +111,9 @@ export default {
},
methods: {
onResized () {
this.debounceResized();
},
debResized() {
this.$nextTick(() => {
if (this.$refs.jsonBox.$el.clientHeight >= 250) {
this.expandableCode = true