Merge pull request #4377 from DophinL/split-panel-resize-bug

fix(split panel): fix issue #4376
This commit is contained in:
Aresn 2018-08-28 09:49:41 +08:00 committed by GitHub
commit 78b7cd0b28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,17 +155,24 @@
on(document, 'mousemove', this.handleMove); on(document, 'mousemove', this.handleMove);
on(document, 'mouseup', this.handleUp); on(document, 'mouseup', this.handleUp);
this.$emit('on-move-start'); this.$emit('on-move-start');
},
computeOffset(){
this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100;
} }
}, },
watch: { watch: {
value () { value () {
this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100; this.computeOffset()
} }
}, },
mounted () { mounted () {
this.$nextTick(() => { 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()
})
} }
}; };
</script> </script>