From f99b7f64c1484522fed9ba6940ce431e4d3368d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=AE=97=E6=BA=90?= <940101379@qq.com> Date: Mon, 27 Aug 2018 19:43:18 +0800 Subject: [PATCH] fix(split panel): fix issue #4376 --- src/components/split/split.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/split/split.vue b/src/components/split/split.vue index 84821404..7a83ebde 100644 --- a/src/components/split/split.vue +++ b/src/components/split/split.vue @@ -155,17 +155,24 @@ on(document, 'mousemove', this.handleMove); on(document, 'mouseup', this.handleUp); this.$emit('on-move-start'); + }, + computeOffset(){ + this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100; } }, watch: { value () { - this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100; + this.computeOffset() } }, mounted () { this.$nextTick(() => { - this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100; + this.computeOffset() }); + + window.addEventListener('resize', ()=>{ + this.computeOffset() + }) } };