fix Slider bug, close #5183
This commit is contained in:
parent
df0d7bd98f
commit
6337de26b4
1 changed files with 12 additions and 4 deletions
|
@ -85,6 +85,7 @@
|
||||||
import { getStyle, oneOf } from '../../utils/assist';
|
import { getStyle, oneOf } from '../../utils/assist';
|
||||||
import { on, off } from '../../utils/dom';
|
import { on, off } from '../../utils/dom';
|
||||||
import Emitter from '../../mixins/emitter';
|
import Emitter from '../../mixins/emitter';
|
||||||
|
import elementResizeDetectorMaker from 'element-resize-detector';
|
||||||
|
|
||||||
const prefixCls = 'ivu-slider';
|
const prefixCls = 'ivu-slider';
|
||||||
|
|
||||||
|
@ -164,6 +165,7 @@
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 1,
|
max: 1,
|
||||||
},
|
},
|
||||||
|
sliderWidth: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -246,9 +248,6 @@
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
sliderWidth () {
|
|
||||||
return parseInt(getStyle(this.$refs.slider, 'width'), 10);
|
|
||||||
},
|
|
||||||
tipDisabled () {
|
tipDisabled () {
|
||||||
return this.tipFormat(this.currentValue[0]) === null || this.showTip === 'never';
|
return this.tipFormat(this.currentValue[0]) === null || this.showTip === 'never';
|
||||||
},
|
},
|
||||||
|
@ -403,7 +402,10 @@
|
||||||
|
|
||||||
handleBlur (type) {
|
handleBlur (type) {
|
||||||
this.$refs[`${type}Tooltip`].handleClosePopper();
|
this.$refs[`${type}Tooltip`].handleClosePopper();
|
||||||
}
|
},
|
||||||
|
handleSetSliderWidth () {
|
||||||
|
this.sliderWidth = parseInt(getStyle(this.$refs.slider, 'width'), 10);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
// #2852
|
// #2852
|
||||||
|
@ -421,6 +423,12 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.observer = elementResizeDetectorMaker();
|
||||||
|
this.observer.listenTo(this.$refs.slider, this.handleSetSliderWidth);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.observer.removeListener(this.$refs.slider, this.handleSetSliderWidth);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue