Skip to content

Commit

Permalink
fix(Slider): fix styling errors in hidden element (#1604)
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao authored Sep 26, 2024
1 parent 884c86d commit e99cbe2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/slider/slider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ref, toRefs, computed, reactive, defineComponent, watch, onMounted } from 'vue';
import isFunction from 'lodash/isFunction';
import { useIntersectionObserver } from '@vueuse/core';
import config from '../config';
import props from './props';
import { useVModel } from '../shared/useVModel';
Expand Down Expand Up @@ -252,6 +253,17 @@ export default defineComponent({
};

onMounted(() => {
init();
});

const { stop } = useIntersectionObserver(rootRef, ([{ isIntersecting }], observerElement) => {
if (isIntersecting) {
stop();
init();
}
});

const init = () => {
getInitialStyle();

if (props.range) {
Expand All @@ -265,7 +277,7 @@ export default defineComponent({
if (props.marks) {
handleMask(props.marks);
}
});
};

const readerMinText = () => {
if (!props.showExtremeValue) {
Expand Down

0 comments on commit e99cbe2

Please sign in to comment.