UNPKG

tdesign-mobile-vue

Version:
57 lines (53 loc) 1.85 kB
/** * tdesign v1.13.2 * (c) 2026 TDesign Group * @license MIT */ import { ref, onMounted } from 'vue'; import { isBrowser } from '../util.mjs'; import '../../_chunks/dep-26006dbd.mjs'; import '../../_chunks/dep-846daeef.mjs'; import 'lodash-es'; import '../../hooks/useClass.mjs'; import '../../config-provider/useConfig.mjs'; import '../../_chunks/dep-57504cfb.mjs'; import '../../_chunks/dep-77efd536.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-476b9e64.mjs'; import '../../_chunks/dep-3b1305c7.mjs'; import '../../_chunks/dep-e0ad6e50.mjs'; import '../../_chunks/dep-bcf957f4.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