UNPKG

tdesign-mobile-vue

Version:
57 lines (53 loc) 1.84 kB
/** * tdesign v1.9.3 * (c) 2025 TDesign Group * @license MIT */ import { ref, onMounted } from 'vue'; import { isBrowser } from '../util.mjs'; import '../../_chunks/dep-26b97ced.mjs'; import '../../_chunks/dep-a953013f.mjs'; import 'lodash-es'; import '../../hooks/useClass.mjs'; import '../../config-provider/useConfig.mjs'; import '../../_chunks/dep-900db0e1.mjs'; import '../../_chunks/dep-4915223e.mjs'; import '../../config-provider/context.mjs'; import '../../_common/js/global-config/mobile/default-config.mjs'; import '../../_common/js/global-config/mobile/locale/zh_CN.mjs'; import '../../_chunks/dep-bca0f578.mjs'; import '../../_chunks/dep-6b2b02fd.mjs'; import '../../_chunks/dep-c6f44a15.mjs'; import '../../_chunks/dep-c984d53e.mjs'; import '../../config-provider/type.mjs'; var overflowScrollReg = /scroll|auto/i; var defaultRoot = isBrowser ? window : void 0; function isElement(node) { var ELEMENT_NODE_TYPE = 1; return node.tagName !== "HTML" && node.tagName !== "BODY" && node.nodeType === ELEMENT_NODE_TYPE; } function getScrollParent(el) { var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRoot; var node = el; while (node && node !== root && isElement(node)) { var _window$getComputedSt = window.getComputedStyle(node), overflowY = _window$getComputedSt.overflowY; if (overflowScrollReg.test(overflowY)) { return node; } node = node.parentNode; } return root; } function useScrollParent(el) { var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRoot; var scrollParent = ref(); onMounted(function () { if (el.value) { scrollParent.value = getScrollParent(el.value, root); } }); return scrollParent; } export { getScrollParent, useScrollParent }; //# sourceMappingURL=index.mjs.map