mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(utils): isHidden support ref element
This commit is contained in:
parent
1e7e7086d6
commit
d659c0c99e
@ -113,7 +113,7 @@ export default createComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onScroll = () => {
|
const onScroll = () => {
|
||||||
if (isHidden(root.value)) {
|
if (isHidden(root)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export default createComponent({
|
|||||||
scrollParentRect.bottom - scrollParentRect.top;
|
scrollParentRect.bottom - scrollParentRect.top;
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
if (!scrollParentHeight || isHidden(root.value)) {
|
if (!scrollParentHeight || isHidden(root)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ export default createComponent({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onScroll = () => {
|
const onScroll = () => {
|
||||||
if (isHidden(root.value)) {
|
if (isHidden(root)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
export function isHidden(el: HTMLElement) {
|
import { unref, Ref } from 'vue';
|
||||||
|
|
||||||
|
export function isHidden(elementRef: HTMLElement | Ref<HTMLElement>) {
|
||||||
|
const el = unref(elementRef);
|
||||||
const style = window.getComputedStyle(el);
|
const style = window.getComputedStyle(el);
|
||||||
const hidden = style.display === 'none';
|
const hidden = style.display === 'none';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user