UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

1 lines 764 B
{"version":3,"file":"utils.mjs","sources":["../../src/anchor/utils.ts"],"sourcesContent":["export const ANCHOR_SHARP_REGEXP = /#(\\S+)$/;\n\nexport type ANCHOR_CONTAINER = HTMLElement | Window;\n\nexport function getOffsetTop(target: HTMLElement, container: ANCHOR_CONTAINER): number {\n const { top } = target.getBoundingClientRect();\n if (container === window) {\n // 减去document的边框\n return top - document.documentElement.clientTop;\n }\n return top - (container as HTMLElement).getBoundingClientRect().top;\n}\n"],"names":[],"mappings":";;;;;;AAAO,sCAAA,IAAA,mBAAA,GAAA,UAAA;AAIA,SAAA,YAAA,CAAA,MAAA,EAAA,SAAA,EAAA;AACL,EAAA,IAAA,qBAAA,GAAA,MAAA,CAAA,qBAAA,EAAA;;;AAGS,IAAA,OAAA,GAAA,GAAA,QAAA,CAAA,eAAA,CAAA,SAAA,CAAA;AACT,GAAA;;AAEF;;;;"}