Commit f99b7f64c1484522fed9ba6940ce431e4d3368d6

Authored by 刘宗源
1 parent 147f23a5

fix(split panel): fix issue #4376

Showing 1 changed file with 9 additions and 2 deletions   Show diff stats
src/components/split/split.vue
@@ -155,17 +155,24 @@ @@ -155,17 +155,24 @@
155 on(document, 'mousemove', this.handleMove); 155 on(document, 'mousemove', this.handleMove);
156 on(document, 'mouseup', this.handleUp); 156 on(document, 'mouseup', this.handleUp);
157 this.$emit('on-move-start'); 157 this.$emit('on-move-start');
  158 + },
  159 + computeOffset(){
  160 + this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100;
158 } 161 }
159 }, 162 },
160 watch: { 163 watch: {
161 value () { 164 value () {
162 - this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100; 165 + this.computeOffset()
163 } 166 }
164 }, 167 },
165 mounted () { 168 mounted () {
166 this.$nextTick(() => { 169 this.$nextTick(() => {
167 - this.offset = (this.valueIsPx ? this.px2percent(this.value, this.$refs.outerWrapper[this.offsetSize]) : this.value) * 10000 / 100; 170 + this.computeOffset()
168 }); 171 });
  172 +
  173 + window.addEventListener('resize', ()=>{
  174 + this.computeOffset()
  175 + })
169 } 176 }
170 }; 177 };
171 </script> 178 </script>