diff --git a/packages/vant/src/text-ellipsis/TextEllipsis.tsx b/packages/vant/src/text-ellipsis/TextEllipsis.tsx index ea9520f6f..1f2ff69bf 100644 --- a/packages/vant/src/text-ellipsis/TextEllipsis.tsx +++ b/packages/vant/src/text-ellipsis/TextEllipsis.tsx @@ -7,11 +7,13 @@ import { type ExtractPropTypes, } from 'vue'; -// Composables -import { useEventListener } from '@vant/use'; - // Utils -import { makeNumericProp, makeStringProp, createNamespace } from '../utils'; +import { + makeNumericProp, + makeStringProp, + createNamespace, + windowWidth, +} from '../utils'; const [name, bem] = createNamespace('text-ellipsis'); @@ -196,9 +198,10 @@ export default defineComponent({ onMounted(calcEllipsised); - watch(() => [props.content, props.rows, props.position], calcEllipsised); - - useEventListener('resize', calcEllipsised); + watch( + [windowWidth, () => [props.content, props.rows, props.position]], + calcEllipsised, + ); return () => (