提交 307ecfb4 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix: 修复vue3 pc端 createSelectorQuery 获取 top 错误问题

上级 cd4f07a3
......@@ -20,11 +20,13 @@ export function getWindowOffset() {
const bottom = getWindowOffsetCssVar(style, '--window-bottom')
const left = getWindowOffsetCssVar(style, '--window-left')
const right = getWindowOffsetCssVar(style, '--window-right')
const topWindowHeight = getWindowOffsetCssVar(style, '--top-window-height')
return {
top,
bottom: bottom ? bottom + safeAreaInsets.bottom : 0,
left: left ? left + safeAreaInsets.left : 0,
right: right ? right + safeAreaInsets.right : 0,
topWindowHeight: topWindowHeight || 0,
}
}
......
......@@ -40,7 +40,7 @@ function getNodeInfo(
fields: NodeField
): SelectorQueryNodeInfo {
const info: SelectorQueryNodeInfo = {}
const { top } = getWindowOffset()
const { top, topWindowHeight } = getWindowOffset()
if (fields.id) {
info.id = el.id
}
......@@ -52,8 +52,8 @@ function getNodeInfo(
if (fields.rect) {
info.left = rect.left
info.right = rect.right
info.top = rect.top - top
info.bottom = rect.bottom - top
info.top = rect.top - top - topWindowHeight
info.bottom = rect.bottom - top - topWindowHeight
}
if (fields.size) {
info.width = rect.width
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册